GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   wordpress experts (https://gfy.com/showthread.php?t=1067303)

Jel 05-07-2012 08:43 AM

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 05-07-2012 09:42 AM

Use the featured image bit

in index.php call for it

ottopottomouse 05-07-2012 09:43 AM

http://codex.wordpress.org/Post_Thumbnails

kuda 05-07-2012 09:43 AM

Possible

Fat Panda 05-07-2012 09:45 AM

yes. very simple and easy

MediaGuy 05-07-2012 09:48 AM

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

Jel 05-07-2012 10:09 AM

Quote:

Originally Posted by ottopottomouse (Post 18933920)
Use the featured image bit

in index.php call for it

Quote:

Originally Posted by ottopottomouse (Post 18933923)

Quote:

Originally Posted by MediaGuy (Post 18933942)
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

moeloubani 05-07-2012 10:12 AM

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

Jel 05-07-2012 10:23 AM

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.

ottopottomouse 05-07-2012 10:45 AM

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.

Jel 05-07-2012 10:48 AM

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

fris 05-07-2012 11:18 AM

just dont add the post thumb on single

acrylix 05-07-2012 11:33 AM

Quote:

Originally Posted by Jel (Post 18933811)
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/

Coyote 05-07-2012 11:50 AM

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.

Jel 05-07-2012 02:28 PM

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.

Jel 05-07-2012 03:17 PM

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

Jel 05-07-2012 03:25 PM

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

Jel 05-07-2012 03:38 PM

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.

Jel 05-07-2012 03:51 PM

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

BSleazy 05-07-2012 03:54 PM

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

bloggingxxx.com

garce 05-07-2012 06:36 PM

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

tonyparra 05-07-2012 07:44 PM

php code in a post? theres a plugin for that..oops see Exec-PHP already posted

BSleazy 05-07-2012 08:33 PM

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.

Jel 05-08-2012 01:17 AM

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 :)

Jel 05-08-2012 01:18 AM

Quote:

Originally Posted by BCyber (Post 18934640)
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.

Jel 05-08-2012 01:27 AM

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

Jel 05-08-2012 01:43 AM

ignore that last question, I really should wake up properly before diving in to work :1orglaugh

tonyparra 05-08-2012 02:15 AM

Quote:

Originally Posted by Jel (Post 18935313)
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.

BSleazy 05-08-2012 02:15 AM

:) 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.

Jel 05-08-2012 02:21 AM

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

Jel 05-08-2012 02:38 AM

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

BSleazy 05-08-2012 02:50 AM

Never had a problem...where did u get it from?

Jel 05-08-2012 02:54 AM

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

BSleazy 05-08-2012 03:02 AM

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

BSleazy 05-08-2012 03:07 AM

http://www.bcyberseo.com/jel/

tonyparra 05-08-2012 03:43 AM

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

tonyparra 05-08-2012 03:46 AM

Quote:

Originally Posted by BCyber (Post 18934640)
I'm confused about what you're trying to do. Something like this?

bloggingxxx.com

i like that blog

ottopottomouse 05-08-2012 03:59 AM

Quote:

Originally Posted by Jel (Post 18934596)
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

Jel 05-08-2012 06:58 AM

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 :)

fris 05-08-2012 07:03 AM

Quote:

Originally Posted by Jel (Post 18935386)

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


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