![]() |
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? |
Use the featured image bit
in index.php call for it |
|
Possible
|
yes. very simple and easy
|
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 |
Quote:
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 |
so you want it to show in the middle of the post or the bottom of the post?
|
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. |
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. |
yeah, given up on trying to fuck about with it.
|
just dont add the post thumb on single
|
Quote:
http://wordpress.org/extend/plugins/shortcode-exec-php/ http://wordpress.org/extend/plugins/exec-php/ |
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. |
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() ) { ?> |
http://forum.bytesforall.com/showthread.php?t=6232 is exactly what it's doing, though I have that unchecked anyway.
|
ok it's the <!--more--> screwing it up ><
|
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.
|
http://wordpress.org/support/topic/t...-with-exec-php is that a fix? How does a thicko implement it?
|
I'm confused about what you're trying to do. Something like this?
bloggingxxx.com |
Lots of help here. Viva La Wordpress as an easy to use CMS.
|
php code in a post? theres a plugin for that..oops see Exec-PHP already posted
|
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.
|
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 :) |
Quote:
|
Actually that Techline theme is pretty good, what's the difference between the free & paid version?
|
ignore that last question, I really should wake up properly before diving in to work :1orglaugh
|
Quote:
Then in every post you create the custom field and enter the image name. |
:) 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.
|
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 :1orglaugh |
holy fuck, note to anyone reading this thread and tempted to try the Techline free theme: don't.
|
Never had a problem...where did u get it from?
|
|
I'm setting up a new wp install and uploading the theme from that link. brb.
|
|
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 :thumbsup |
Quote:
|
Quote:
|
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 :) |
Quote:
|
All times are GMT -7. The time now is 02:47 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123