![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
She is ugly, bad luck.
Industry Role:
Join Date: Jan 2010
Posts: 13,177
|
Use the featured image bit
in index.php call for it
__________________
↑ see post ↑ 13101 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
She is ugly, bad luck.
Industry Role:
Join Date: Jan 2010
Posts: 13,177
|
__________________
↑ see post ↑ 13101 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Sep 2003
Location: Córdoba, Argentina
Posts: 31
|
Possible
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Porn is Dead. Move along.
Industry Role:
Join Date: Aug 2006
Posts: 13,295
|
yes. very simple and easy
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Sep 2004
Location: Montrealquebecanada
Posts: 5,500
|
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | ||
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
Quote:
Quote:
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 |
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Dec 2007
Location: Ontario
Posts: 4,235
|
so you want it to show in the middle of the post or the bottom of the post?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
She is ugly, bad luck.
Industry Role:
Join Date: Jan 2010
Posts: 13,177
|
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
yeah, given up on trying to fuck about with it.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Industry Role:
Join Date: Oct 2006
Posts: 362
|
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/ |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Drinker of Scotch
Industry Role:
Join Date: May 2003
Location: Texas
Posts: 242
|
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
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--> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
http://forum.bytesforall.com/showthread.php?t=6232 is exactly what it's doing, though I have that unchecked anyway.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#17 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
ok it's the <!--more--> screwing it up ><
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#18 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
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.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#19 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
http://wordpress.org/support/topic/t...-with-exec-php is that a fix? How does a thicko implement it?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#20 |
Confirmed User
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
|
I'm confused about what you're trying to do. Something like this?
bloggingxxx.com
__________________
icq 156131086 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#21 |
Confirmed User
Industry Role:
Join Date: Oct 2001
Location: Toronto
Posts: 7,103
|
Lots of help here. Viva La Wordpress as an easy to use CMS.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#22 |
Confirmed User
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
|
php code in a post? theres a plugin for that..oops see Exec-PHP already posted
__________________
High Performance Vps $10 Linode Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#23 |
Confirmed User
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
|
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#24 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
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 ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#25 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#26 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
Actually that Techline theme is pretty good, what's the difference between the free & paid version?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#27 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
ignore that last question, I really should wake up properly before diving in to work
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#28 | |
Confirmed User
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
|
Quote:
Then in every post you create the custom field and enter the image name.
__________________
High Performance Vps $10 Linode Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#29 |
Confirmed User
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
|
![]()
__________________
icq 156131086 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#30 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
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 ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#31 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
holy fuck, note to anyone reading this thread and tempted to try the Techline free theme: don't.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#32 |
Confirmed User
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
|
Never had a problem...where did u get it from?
__________________
icq 156131086 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#33 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#34 |
Confirmed User
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
|
I'm setting up a new wp install and uploading the theme from that link. brb.
__________________
icq 156131086 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#35 |
Confirmed User
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
|
__________________
icq 156131086 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#36 |
Confirmed User
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
|
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#37 |
Confirmed User
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
|
i like that blog
__________________
High Performance Vps $10 Linode Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#38 |
She is ugly, bad luck.
Industry Role:
Join Date: Jan 2010
Posts: 13,177
|
Ignore the more and use an excerpt on the index instead of the post contents http://codex.wordpress.org/Excerpt
__________________
↑ see post ↑ 13101 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#39 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
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 ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#40 | |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 55,372
|
Quote:
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. ![]() WP Stuff |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#41 |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 55,372
|
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. ![]() WP Stuff |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#42 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
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> Code:
<?php get_post_custom_values("featured-images")( array (640,480) );?> ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#43 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#44 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
morning bump
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#45 |
She is ugly, bad luck.
Industry Role:
Join Date: Jan 2010
Posts: 13,177
|
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" />
__________________
↑ see post ↑ 13101 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#47 | |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
Quote:
otto - so: Code:
<img src="<?php echo get_post_meta($post->ID, 'featured-images', true); ?>" alt="" height="480" width="640" /> |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#48 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
yup that'll be it, thanks guys
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#49 |
Confirmed User
Industry Role:
Join Date: Feb 2007
Posts: 6,904
|
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?
|
![]() |
![]() ![]() ![]() ![]() ![]() |