meteor slides not linking to post
-
Hi I have a quick question… I am having trouble with the meteor slides not linking to the posts. some of them do work some of them don’t. Any ideas??
http://www.amexicaninthekitchen.com
Thanks
-
Hi, if the slides are linking to the slide posts instead of the links that you added to the slides your theme(or maybe a plugin) is filtering featured images and automatically adding the permalink to them.
Check in your functions.php file for a filter that is affecting post thumbnails and try removing it. If this also removes links from the thumbnails of your blog posts, you’ll have to add anchors around the featured images in your theme’s template files.
how would I go about adding anchors to my image files?
Add them the same way they are added to the title links, it might look something like this:
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a>
I know what and how to add an anchor… what Im asking is which images am I adding anchors to? The slide images? Where and how would I do that?
Thanks π
The slide images will still have links, only the thumbnails for your blog posts will need them added, the tag for the thumbnails should look like this:
<?php the_post_thumbnail(); ?>
will that interfere with the thumbnail images linking to the posts
I have it set up like this. in my functions folder..
// This theme uses post thumbnails if ( function_exists( 'add_theme_support' ) ){ add_theme_support( 'post-thumbnails' ); add_image_size('Home page', 120, 120, true); add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 ); function my_post_image_html( $html, $post_id, $post_image_id ) { $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>'; return $html; }
That’s the filter you need to get rid of, you don’t want to add links to all the post thumbnails on your site because some of them, like the slide images in the slideshow, might not need a link, or all ready have one.
Leave the first 4 lines that add thumbnail support and the custom image size, and remove that filter:
add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 ); function my_post_image_html( $html, $post_id, $post_image_id ) { $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>'; return $html; }
Then add those permalinks in your theme instead just where you need them. Like in your homepage template there should be a tag like this:
<?php the_post_thumbnail('Home page'); ?>
I dont have a home page template… I am using a custom category menu.
Well, whichever template you are using for your homepage that is loading those thumbnails: front-page.php, home.php, or index.php.
i believe it is going to interfere with the grid loop
What do you think?
Can I make the slide not linkable at all? like if they click on a image it wont take them away from the page?
If you’re using this code for your homepage then edit that to add the links to the thumbnails. You just need to link them directly instead of dynamically, just like the titles are linked.
Try replacing this:
<div class="post-thumb"> <?php echo get_the_post_thumbnail( $post_id, $size, $attr ); ?> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> </div>
With this:
<div class="post-thumb"> <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo get_the_post_thumbnail( $post_id, $size, $attr ); ?></a> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> </div>
it worked π Thank you!!!! SO MUCH!!
No problem, glad that worked for you!
- The topic ‘meteor slides not linking to post’ is closed to new replies.