- This topic is empty.
-
AuthorPosts
-
July 23, 2011 at 9:11 pm #33617WildSpiritMember
I am currently using the Genesis theme from StudioPress and really like it BUT am not very good at php so I have run into a little problem!
Here is the page I’m working on: http://bosstin.wildspiritdesigns.com/category/bassandbaitBefore I made any changes, each product image linked to the post that went with it. What I wanted was for the image to just enlarge when clicked on. Figured that out (not sure if it’s the easiest solution but seems to be working!) but now I want to add a little piece of text under the image that says “Click Image to Enlarge”.
Here is the current code I have. I was hoping Genesis had an easy way to do this but after asking around on their forums was told there was not. I was given the “add_action” code and got the “if (has_post_thumbnail)” to end for the WP Forums. If there is any other info needed let me know!
function child_do_grid_loop() {
global $query_string, $paged;
// Ensure the arguments for the normal query for the page are carried forwards
parse_str( $query_string, $query_args );
// Create an array of arguments for the loop - can be grid-specific, or
// normal query_posts() arguments to alter the loop
$grid_args = array(
'features' => 0,
'feature_image_size' => 0,
'feature_image_class' => 'alignleft post-image',
'feature_content_limit' => 0,
'grid_image_size' => '0',
'grid_image_class' => 'alignleft post-image',
'grid_content_limit' => 0,
'more' => __( '', 'genesis' ),
'posts_per_page' => 100
);
add_action( 'genesis_before_post_content', 'child_function_name' );
function child_function_name() {
if ( has_post_thumbnail()) {
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
echo '';
the_post_thumbnail('thumbnail');
echo 'Click Image to Enlarge
';
echo '';
}
}
Do I need to some how add a div in there to style the “click to enlarge” text??
Thanks,
LyleJuly 24, 2011 at 1:12 am #83861stevendeedsMemberIs it not echoing that paragraph with the ‘click image to enlarge’ text? I would probably make that part its own function, I definitely wouldn’t put it in the anchor tag like you have it, and you can style the paragraph however you want, just add a class to it..
and remember, you have to call a function after you set it up for it to output anything..July 24, 2011 at 2:05 am #83866WildSpiritMemberIt is echoing the “Click image to enlarge” text it’s just not under the images it’s to the right of the image above the description of the text… I really don’t know anything about functions, it’s a miracle that the one for the image thumbnail worked as I copied and pasted it in for where I found it in my searches!!
July 25, 2011 at 11:09 am #83922WildSpiritMemberStill haven’t been able to figure this out. Not even sure really how to set up a function on my own. Is there a way it can be a function within this current one? Do the divs with class have to be echoed to make it work?
July 25, 2011 at 12:12 pm #83910stevendeedsMemberOH! well then you just need to style your element. Remember, php reads your code, and outputs as plain html! so, if you want to style the element, just make that p tag a p class=”click”..
so like…
echo '
' . 'Click Image To Enlarge' . '
';and then your css would be something like..
.click {float: left; }
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.