I have the home page http://www.faberunashop.com posts set up so that when you click on each individual post you get redirected to another site. I just noticed that when you search or use the categories, the posts ignore my custom code and let you enter the post instead. How do I fix that?
How does your loop code look like? I can see you have the images wrapped in a anchor tag linking to the appropriate website. However, the link on your categories/searches lead to the post indeed. My guess is your loop code on your home page is different than the loop code on your categories page, so try checking that or post them here.
<?php get_header(); ?> <?php /* If this is a category archive */ if (is_category()) { ?> <h1><?php printf(__('Archive for the ‘%s’ Category'), single_cat_title('', false)); ?></h1> <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> <h1"><?php printf(__('Posts Tagged ‘%s’'), single_tag_title('', false) ); ?></h1> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <h1><?php printf(_c('Archive for %s|Daily archive page'), get_the_time(__('F jS, Y'))); ?></h1> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <h1><?php printf(_c('Archive for %s|Monthly archive page'), get_the_time(__('F, Y'))); ?></h1> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <h1><?php printf(_c('Archive for %s|Yearly archive page'), get_the_time(__('Y'))); ?></h1> <?php /* If this is an author archive */ } elseif (is_author()) { ?> <h1><?php _e('Author Archive'); ?></h1> <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h1><?php _e('Blog Archives'); ?></h1> <?php } ?>
LOL! Don't mess with a Monday morning brain. I am using the Imbalance theme from www.wpshower.com and I only changed the text in the search.php, that is all.
I know the solution is probably simple but I really just want my search and category section to behave like my homepage: click on the post image and be taken to another site.
Ah ok, so I think to resolve this, you would need to add a code in your functions.php file to only allow the URL specified in your search results. @TheDoc knows more about this than I do.
I'm not entirely sure how to resolve this. I know a minimum of php and Wordpress. You could try either stackoverflow.com or the Wordpress forums. Hopefully someone else here can help.
Ok I only quickly scanned the code you posted, no idea if I have the right thing here.. but in your index.php file, right after your
you are calling that function you posted here above: <?php print_post_title() ?>.In your archive.php and your search.php file, there is no such line after your <div class="article-over">,instead it immediately has a <h2>with the_permalink.Perhaps try adding in that same line of code like you have on your index.php page?
I think this might solve it, but I'm not 100% sure.. because even though the whole image is clickable on your index.php page, the print_post_titlefunction only echo's a <h2>with the_permalink,which doesn't wrap around the image.. Weird, but this might be a start?
So, basically, anywhere you see "the_permalink", it's going to be linking to the post in question, and not your redirect. If you just comb through your search.php file you'll see what I'm talking about. But here's an example:
In this line: <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> You'll see the_permalink. This is what links to your post. If you don't want it to link to your post, you'll have to change that.
Anywhere you see: <a href="<?php the_permalink() ?>"> It will link to the post.
[SOLVED] Fixed it. Instead of changing the code, which I have NO idea how to (I just tinker) I found a plugin that does it just as well. Thanks for your help!
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
<?php get_footer(); ?>
Edit your post, select the code and press the 'Code' button (4th button from the left on this comment box).
I think the problem resolves in the search.php template and I'm not sure why you have your h2 like this:
<?php print_post_title() ?>.In your archive.php and your search.php file, there is no such line after your<div class="article-over">,instead it immediately has a<h2>withthe_permalink.Perhaps try adding in that same line of code like you have on yourindex.phppage?I think this might solve it, but I'm not 100% sure.. because even though the whole image is clickable on your index.php page, the
print_post_titlefunction only echo's a<h2>withthe_permalink,which doesn't wrap around the image.. Weird, but this might be a start?What do i replace?
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>You'll see the_permalink. This is what links to your post. If you don't want it to link to your post, you'll have to change that.
Anywhere you see:
<a href="<?php the_permalink() ?>">It will link to the post.