wordpress experts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jel
    Confirmed User
    • Feb 2007
    • 6904

    #1

    wordpress experts

    Any way to use php inside a post? What I want to do is have a post, with an image linked to the permalink, using the if is_home to show the image on the main page, but not replicated on the single page.

    Possible, or not?
  • ottopottomouse
    She is ugly, bad luck.
    • Jan 2010
    • 13177

    #2
    Use the featured image bit

    in index.php call for it
    ↑ see post ↑
    13101

    Comment

    • ottopottomouse
      She is ugly, bad luck.
      • Jan 2010
      • 13177

      #3
      http://codex.wordpress.org/Post_Thumbnails
      ↑ see post ↑
      13101

      Comment

      • kuda
        Confirmed User
        • Sep 2003
        • 31

        #4
        Possible
        Buy & Sell Ads on The Most Sexy Advertising Network on the Planet

        available ad spots
        | sign up now

        Comment

        • Fat Panda
          Porn is Dead. Move along.
          • Aug 2006
          • 13296

          #5
          yes. very simple and easy

          Comment

          • MediaGuy
            Confirmed User
            • Sep 2004
            • 5500

            #6
            Yeah you can surely use PHP in a post - why not? Wordpress is PHP based - though depending you might need to use the wp-includes folder....

            What kind of PHP are you thinking? Is it ultra recent or not compliant to the most recent update for some reason?

            :D

            YOU Are Industry News!
            Press Releases: pr[at]payoutmag.com
            Facebook: Payout Magazine! Facebook: MIKEB!
            ICQ: 248843947
            Skype: Mediaguy1

            Comment

            • Jel
              Confirmed User
              • Feb 2007
              • 6904

              #7
              Originally posted by ottopottomouse
              Use the featured image bit

              in index.php call for it
              Originally posted by ottopottomouse
              Originally posted by MediaGuy
              Yeah you can surely use PHP in a post - why not? Wordpress is PHP based - though depending you might need to use the wp-includes folder....

              What kind of PHP are you thinking? Is it ultra recent or not compliant to the most recent update for some reason?

              :D
              I fucking *suck* at anything even remotely difficult - I can't stress that enough. I've been looking at thumbnails, featured images, and can't make head nor tail of it.

              Here's what I want to do:

              Post Goes Here
              blah text blah

              <if is home php string>image linked to single-post<end php string>
              <more>
              video
              more text
              ad

              Comment

              • moeloubani
                Confirmed User
                • Dec 2007
                • 4235

                #8
                so you want it to show in the middle of the post or the bottom of the post?

                Comment

                • Jel
                  Confirmed User
                  • Feb 2007
                  • 6904

                  #9
                  I want to display something on the home page within a post, but not on the permalink, within a post. Using the if is_home php string.

                  Inserting it into a post does not do it, it simply shows the code as text.

                  Comment

                  • ottopottomouse
                    She is ugly, bad luck.
                    • Jan 2010
                    • 13177

                    #10
                    Not sure how to do it in the middle of the post. Calling the post thumbnail is usually before or after like

                    title
                    date stuff
                    image
                    post contents

                    You can't just put php in a post it would be a huge security risk if you had other posters than just the admin.
                    ↑ see post ↑
                    13101

                    Comment

                    • Jel
                      Confirmed User
                      • Feb 2007
                      • 6904

                      #11
                      yeah, given up on trying to fuck about with it.

                      Comment

                      • fris
                        I have to go potty
                        • Aug 2002
                        • 55751

                        #12
                        just dont add the post thumb on single
                        Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                        Totally Free Templates

                        Comment

                        • acrylix
                          Confirmed User
                          • Oct 2006
                          • 362

                          #13
                          Originally posted by Jel
                          Any way to use php inside a post?
                          There are various plugins which allow you to execute php in a post. For example:

                          http://wordpress.org/extend/plugins/shortcode-exec-php/

                          http://wordpress.org/extend/plugins/exec-php/

                          Comment

                          • Coyote
                            Drinker of Scotch
                            • May 2003
                            • 236

                            #14
                            You don't need to execute php within a post to accomplish what you want. The easiest method is to create a short-code handler. Read about it here.

                            You would write your normal post, and embed the short-code where ever you want an image to appear, then continue writing your post content.

                            The short-code handler is 'similar' to a callback function and gets executed each time that post is displayed. For your intent, the short-code handler will test whether the post is displayed on the home page, and if true, will display the desired image. If it is false, it will simply remove the short-code you entered and return only the post content, without the image.
                            Ethernet Servers

                            Quote:
                            CS: Linux can pretty much run on a potato. Which is a GOOD thing.

                            Comment

                            • Jel
                              Confirmed User
                              • Feb 2007
                              • 6904

                              #15
                              exec-php plugin does what I want to do, with the small problem that the php code is still displayed in the post body..

                              Code:
                              <?php if ( is_home() ) { ?>
                              <a href="http://www.domain.com/?p=permalink"><img src="http://www.domain.com/xyz.jpg" border="0"></a>
                              some text
                              <?php } ?>
                              <!--more-->
                              image links to the permalink, image disappears on the permalink page, but above and below the image on the home page, the php code is visible. Not sure what that could be, being very thick when it comes to this stuff.

                              Comment

                              • Jel
                                Confirmed User
                                • Feb 2007
                                • 6904

                                #16
                                http://forum.bytesforall.com/showthread.php?t=6232 is exactly what it's doing, though I have that unchecked anyway.

                                Comment

                                • Jel
                                  Confirmed User
                                  • Feb 2007
                                  • 6904

                                  #17
                                  ok it's the <!--more--> screwing it up ><

                                  Comment

                                  • Jel
                                    Confirmed User
                                    • Feb 2007
                                    • 6904

                                    #18
                                    fucks sake this is like the da vinci code. Is there/what is the full code that the quicktag <!--more--> relates to? I'm hoping to inser that, in full, and hopefully overcome the issue.

                                    Comment

                                    • Jel
                                      Confirmed User
                                      • Feb 2007
                                      • 6904

                                      #19
                                      http://wordpress.org/support/topic/t...-with-exec-php is that a fix? How does a thicko implement it?

                                      Comment

                                      • BSleazy
                                        Confirmed User
                                        • Aug 2002
                                        • 6721

                                        #20
                                        I'm confused about what you're trying to do. Something like this?

                                        bloggingxxx.com
                                        icq 156131086

                                        Comment

                                        • garce
                                          Confirmed User
                                          • Oct 2001
                                          • 7103

                                          #21
                                          Lots of help here. Viva La Wordpress as an easy to use CMS.

                                          Comment

                                          • tonyparra
                                            Confirmed User
                                            • Jul 2008
                                            • 4568

                                            #22
                                            php code in a post? theres a plugin for that..oops see Exec-PHP already posted
                                            Last edited by tonyparra; 05-07-2012, 06:46 PM.

                                            High Performance Vps $10 Linode
                                            Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

                                            Comment

                                            • BSleazy
                                              Confirmed User
                                              • Aug 2002
                                              • 6721

                                              #23
                                              Ya after re-reading this, all you need to do is use featured images on your main page (index.php) and don't add them to single.php.
                                              icq 156131086

                                              Comment

                                              • Jel
                                                Confirmed User
                                                • Feb 2007
                                                • 6904

                                                #24
                                                pretend I don't know how to use featured images, or how to include that on the home page but not single pages, nor understand the gobbledygook on http://codex.wordpress.org/Post_Thumbnails - what's the easiest step-by-step someone can give? I want to upload the pics via ftp and not have to use wp upload thingy.

                                                Thanks

                                                Comment

                                                • Jel
                                                  Confirmed User
                                                  • Feb 2007
                                                  • 6904

                                                  #25
                                                  Originally posted by BCyber
                                                  I'm confused about what you're trying to do. Something like this?

                                                  bloggingxxx.com
                                                  Yes, but not have the image and accompanying text show on the single post, just the video and anything after it.

                                                  Comment

                                                  • Jel
                                                    Confirmed User
                                                    • Feb 2007
                                                    • 6904

                                                    #26
                                                    Actually that Techline theme is pretty good, what's the difference between the free & paid version?

                                                    Comment

                                                    • Jel
                                                      Confirmed User
                                                      • Feb 2007
                                                      • 6904

                                                      #27
                                                      ignore that last question, I really should wake up properly before diving in to work

                                                      Comment

                                                      • tonyparra
                                                        Confirmed User
                                                        • Jul 2008
                                                        • 4568

                                                        #28
                                                        Originally posted by Jel
                                                        pretend I don't know how to use featured images, or how to include that on the home page but not single pages, nor understand the gobbledygook on http://codex.wordpress.org/Post_Thumbnails - what's the easiest step-by-step someone can give? I want to upload the pics via ftp and not have to use wp upload thingy.

                                                        Thanks
                                                        you can upload via ftp and create a custom field? Im lost as to what you need but a statement like this <img src="/your-directory/<?php echo get_post_meta($post->ID,img name here, true); ?">

                                                        Then in every post you create the custom field and enter the image name.
                                                        Last edited by tonyparra; 05-08-2012, 01:17 AM.

                                                        High Performance Vps $10 Linode
                                                        Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

                                                        Comment

                                                        • BSleazy
                                                          Confirmed User
                                                          • Aug 2002
                                                          • 6721

                                                          #29
                                                          Paid removes the footer links. I modded the one above so it looks a little different then then techline. Hit me up later when I wake up. If you show me your site/theme I'll tell you what exactly needs to be done. You really don't need any plugin to include php. Just need to mod the theme.
                                                          icq 156131086

                                                          Comment

                                                          • Jel
                                                            Confirmed User
                                                            • Feb 2007
                                                            • 6904

                                                            #30
                                                            yeah techline (free) just crashed 2 sites I installed it on, host tech: causing PHP to hard stop and crash. It'd actually be ideal but I'm completely put off using it after that lol.

                                                            Tony - "a statement like etc" - again, I emphasize my tech idiocy. A statement where? I cannot stress enough just how dumbed down I need things to be

                                                            Comment

                                                            • Jel
                                                              Confirmed User
                                                              • Feb 2007
                                                              • 6904

                                                              #31
                                                              holy fuck, note to anyone reading this thread and tempted to try the Techline free theme: don't.

                                                              Comment

                                                              • BSleazy
                                                                Confirmed User
                                                                • Aug 2002
                                                                • 6721

                                                                #32
                                                                Never had a problem...where did u get it from?
                                                                icq 156131086

                                                                Comment

                                                                • Jel
                                                                  Confirmed User
                                                                  • Feb 2007
                                                                  • 6904

                                                                  #33
                                                                  http://newwpthemes.com/techline-free-wordpress-theme/

                                                                  Comment

                                                                  • BSleazy
                                                                    Confirmed User
                                                                    • Aug 2002
                                                                    • 6721

                                                                    #34
                                                                    I'm setting up a new wp install and uploading the theme from that link. brb.
                                                                    icq 156131086

                                                                    Comment

                                                                    • BSleazy
                                                                      Confirmed User
                                                                      • Aug 2002
                                                                      • 6721

                                                                      #35
                                                                      http://www.bcyberseo.com/jel/
                                                                      icq 156131086

                                                                      Comment

                                                                      • tonyparra
                                                                        Confirmed User
                                                                        • Jul 2008
                                                                        • 4568

                                                                        #36
                                                                        A theme caused you site to crash? Probably a conflict with a plugin etc

                                                                        In your index.php or home.php file, the place where the image goes put <a href="your-link or permalink"><img src="/path/to/<?php echo get_post_meta($post->ID,custom field name, true); ?">"></a>

                                                                        then in the post area add a custom field, the name is custom field name and the value is the image name. Note i dont thinks this is the easiest way just trying too help you with your question

                                                                        High Performance Vps $10 Linode
                                                                        Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

                                                                        Comment

                                                                        • tonyparra
                                                                          Confirmed User
                                                                          • Jul 2008
                                                                          • 4568

                                                                          #37
                                                                          Originally posted by BCyber
                                                                          I'm confused about what you're trying to do. Something like this?

                                                                          bloggingxxx.com
                                                                          i like that blog

                                                                          High Performance Vps $10 Linode
                                                                          Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

                                                                          Comment

                                                                          • ottopottomouse
                                                                            She is ugly, bad luck.
                                                                            • Jan 2010
                                                                            • 13177

                                                                            #38
                                                                            Originally posted by Jel
                                                                            ok it's the <!--more--> screwing it up ><
                                                                            Ignore the more and use an excerpt on the index instead of the post contents http://codex.wordpress.org/Excerpt
                                                                            ↑ see post ↑
                                                                            13101

                                                                            Comment

                                                                            • Jel
                                                                              Confirmed User
                                                                              • Feb 2007
                                                                              • 6904

                                                                              #39
                                                                              yeah most likely a plugin tony - in which case the theme is no good to me unfortunately.

                                                                              The other stuff - most likely a piece of piss, but I just don't read instructions well.

                                                                              otto - same thing. I'll fuck this idea off, but a big thanks to everyone who attempted to help me

                                                                              Comment

                                                                              • fris
                                                                                I have to go potty
                                                                                • Aug 2002
                                                                                • 55751

                                                                                #40
                                                                                please dont install this theme, it has nasty virus code in it which cycles through all your themes and adds the code to every theme in the theme dir
                                                                                Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                                                                                Totally Free Templates

                                                                                Comment

                                                                                • fris
                                                                                  I have to go potty
                                                                                  • Aug 2002
                                                                                  • 55751

                                                                                  #41
                                                                                  plus if you just dont wanna include thumb on full post, running a php exec plugin is a very bad idea. stay far away from that as possible.
                                                                                  Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                                                                                  Totally Free Templates

                                                                                  Comment

                                                                                  • Jel
                                                                                    Confirmed User
                                                                                    • Feb 2007
                                                                                    • 6904

                                                                                    #42
                                                                                    ok this is driving me bonkers...

                                                                                    I set featured-images, and assign full path to image for that

                                                                                    index.php I have this code:

                                                                                    Code:
                                                                                    <?php the_post_thumbnail( array (640,480) );?>	  
                                                                                    	  
                                                                                    	<?php the_content(__('Read more'));?><div style="clear:both;"></div>
                                                                                    and get fuck all show, so assumed it was because it's a custom field and not 'set featured image' so used:

                                                                                    Code:
                                                                                    <?php get_post_custom_values("featured-images")( array (640,480) );?>
                                                                                    and a ton of other variations with no joy. I'm fairly sure this must be pretty simple, but I'm absolutely fucked if I can figure it out, help appreciated

                                                                                    Comment

                                                                                    • Jel
                                                                                      Confirmed User
                                                                                      • Feb 2007
                                                                                      • 6904

                                                                                      #43
                                                                                      Originally posted by BCyber
                                                                                      Ya after re-reading this, all you need to do is use featured images on your main page (index.php) and don't add them to single.php.
                                                                                      This - what's the code to insert in the loop?

                                                                                      Comment

                                                                                      • Jel
                                                                                        Confirmed User
                                                                                        • Feb 2007
                                                                                        • 6904

                                                                                        #44
                                                                                        morning bump

                                                                                        Comment

                                                                                        • ottopottomouse
                                                                                          She is ugly, bad luck.
                                                                                          • Jan 2010
                                                                                          • 13177

                                                                                          #45
                                                                                          CUSTOM-FIELD-NAME filled out with image address

                                                                                          Code:
                                                                                          <img src="<?php echo get_post_meta($post->ID, 'CUSTOM-FIELD-NAME', true); ?>" alt="" height="480" width="640" />
                                                                                          Can call another field for the alt tag or create something related to the post title etc.
                                                                                          ↑ see post ↑
                                                                                          13101

                                                                                          Comment

                                                                                          • fris
                                                                                            I have to go potty
                                                                                            • Aug 2002
                                                                                            • 55751

                                                                                            #46
                                                                                            just dont call it from single.php
                                                                                            Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                                                                                            Totally Free Templates

                                                                                            Comment

                                                                                            • Jel
                                                                                              Confirmed User
                                                                                              • Feb 2007
                                                                                              • 6904

                                                                                              #47
                                                                                              Originally posted by ottopottomouse
                                                                                              CUSTOM-FIELD-NAME filled out with image address

                                                                                              Code:
                                                                                              <img src="<?php echo get_post_meta($post->ID, 'CUSTOM-FIELD-NAME', true); ?>" alt="" height="480" width="640" />
                                                                                              Can call another field for the alt tag or create something related to the post title etc.
                                                                                              fris - gotcha

                                                                                              otto - so:

                                                                                              Code:
                                                                                              <img src="<?php echo get_post_meta($post->ID, 'featured-images', true); ?>" alt="" height="480" width="640" />
                                                                                              in this case I presume?

                                                                                              Comment

                                                                                              • Jel
                                                                                                Confirmed User
                                                                                                • Feb 2007
                                                                                                • 6904

                                                                                                #48
                                                                                                yup that'll be it, thanks guys

                                                                                                Comment

                                                                                                • Jel
                                                                                                  Confirmed User
                                                                                                  • Feb 2007
                                                                                                  • 6904

                                                                                                  #49
                                                                                                  1 thing - what would I use to have that image linked to the permalink?wrap a href around that img srcobviously, but the actual php code?

                                                                                                  Comment

                                                                                                  • fris
                                                                                                    I have to go potty
                                                                                                    • Aug 2002
                                                                                                    • 55751

                                                                                                    #50
                                                                                                    put <a href="<?php the_permalink();?>img code here</a>
                                                                                                    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                                                                                                    Totally Free Templates

                                                                                                    Comment

                                                                                                    Working...