Using get_the_image() in Pagelines Framework 2.0
Started by
svakanda
, May 09 2012 11:12 PM
13 replies to this topic
#1
Posted 09 May 2012 - 11:12 PM
Hi,
I've been trying all afternoon to successfully integrate Get The Image wordpress plugin into my pagelines framework 2.1.6 theme.
I've been poking around in class.posts.php, and I haven't quite been able to figure it out. I've tried to set several variables to the return value of get_the_image() so that the results of that function would be sent along to pagelines, but its more complex then I imagined. I was able to do this very easily in platform pro, but obviously pagelines is a more complex system.
Could anyone point me in the right direction here? I want my excerpt images/post thumbails to display the results of the get_the_image() plugin function...I just don't know where to plug it in to pagelines theme.
I've spent hours on this, and my head is all fuzzy and hurting =( Any suggestions or tips would be greatly appreciated.
R
#2
Posted 09 May 2012 - 11:43 PM
First, it's really a bad idea to edit core pages as they would be overwritten with the next update and all your work would be lost, not to mention, it's not a supported activity.
I don't know that plugin, but per the WordPress page for it, I'm seeing that a php include is suggested. Not sure where you plan to place the images, but, it may be best to try the PHP as a shortcode. You'd do that with Shortcode Exec PHP http://wordpress.org...tcode-exec-php/
#3
Posted 10 May 2012 - 12:00 AM
Thanks Rangelone, I understand about the update system. I am just trying to figure out WHERE I would do it, before I setup a child template for the fix.
Here is the documentation for get-the-image...
http://moneyquestion...age/readme.html
I checked out the shortcode suggestion...and thats all great, an easy way to execute PHP. But it's not just an arbitrary piece of php I am looking to execute....
the get_the_image() function will return a thumbnail image for me, and I am looking to replace the default featured image in the Postloop, with the image returned by get_the_image()...So I still need to figure out where the featured image thumbnail is set in the postloop.
#4
Posted 10 May 2012 - 12:08 AM
Wow. Sounds like a great plugin, but it is going to take lots of customization that I'm sorry to say, goes beyond my skill set. It just ruined my ego. lol.
I think this is going to need the help of one of our pros to craft a specialized hook. I'm very familiar with hooks, but this involves the source of the thumbnail. I'm not sure if you'd find it worthwhile but let me suggest getting a quote from http://www.pagelines.com/pros.
I'm pretty confident it can be done, I just don't know quite how. Apologies. I'm going to have to go back to the drawing board on this one.
#5
Posted 10 May 2012 - 12:09 AM
Oh, one of my colleagues might have a better idea, so don't give up the ship!
#6
Posted 10 May 2012 - 01:31 AM
Thanks Rangelone, I won't =)
#7
Posted 10 May 2012 - 02:36 AM
Do you need further assistance or will you be contacting a Pro?
#8
Posted 10 May 2012 - 04:17 AM
I'm bashing my head against it until I can figure it out. Any pointers or thoughts are much appreciated Catrina.
#9
Posted 10 May 2012 - 05:23 AM
Thanks for the help. I think I've found it.
Around line 383 on includes/class.posts.php
is this line:
My get the image plugin is actually not serving up the image correctly, I think it must be the most recent version of wordpress perhaps. So I'm playing with it more, but at least I know where to insert it now =)
Around line 383 on includes/class.posts.php
is this line:
$img = ( $mode == 'top' ) ? get_the_post_thumbnail( null, 'large' ) : get_the_post_thumbnail( null, 'thumbnail' );
My get the image plugin is actually not serving up the image correctly, I think it must be the most recent version of wordpress perhaps. So I'm playing with it more, but at least I know where to insert it now =)
#10
Posted 10 May 2012 - 05:51 AM
Okay!!! I figured it ALL out. Get The Image works FINE with Pagelines 2.0 and here is how...replace
this line, around 383 on includes/class.posts.php
with this line
That echo parameter being set to false is very important...it sets the function output as a return value instead of an echo, so you can pass the image data back into Pagelines.
this line, around 383 on includes/class.posts.php
$img = ( $mode == 'top' ) ? get_the_post_thumbnail( null, 'large' ) : get_the_post_thumbnail( null, 'thumbnail' );
with this line
$img = get_the_image( array( 'echo' => false, 'image_class' => "attachment-thumbnail wp-post-image" ));
That echo parameter being set to false is very important...it sets the function output as a return value instead of an echo, so you can pass the image data back into Pagelines.
#11
Posted 10 May 2012 - 05:53 AM
hmmm is there any way to mark this discussion as resolved? I can't accept my own post as an answer...ALSO, for the fix above, you should probably do it under a child theme like rangelone mentioned.
#12
Posted 10 May 2012 - 06:18 AM
mmhmm few more nuances here....
around line 270 you will see this:
It is the conditional that determines which posts DESERVE to process the thumbnail code.
In my case, I changed it to this:
Which tells ALL posts to process the thumbnail code, regardless of whether or not they have a featured image.
around line 270 you will see this:
$thumb = ( $this->pagelines_show_thumb( $id ) ) ? $this->post_thumbnail_markup( $excerpt_mode, $format ) : '';
It is the conditional that determines which posts DESERVE to process the thumbnail code.
In my case, I changed it to this:
$thumb = $this->post_thumbnail_markup( $excerpt_mode, $format );
Which tells ALL posts to process the thumbnail code, regardless of whether or not they have a featured image.
#13
Posted 10 May 2012 - 10:11 AM
Hi svakanda,
Is this issue now resolved? If so please inform me and I will set the topic to resolved.
#14
Posted 18 July 2012 - 04:56 PM
Yeah its resolved...it works fine. Thanks Danny.











