How can I make the “Preview Post” button save and preview in the same window?

When you choose “Preview”, which is actually a link, <a class=”preview button” href=”https://wordpress.stackexchange.com/questions/35517/?p=52&amp;preview=true” id=”post-preview” tabindex=”4″>Preview</a> the post is saved and the preview opens in a new window. I’m sure there is a javascript event attached to this button, I’d like to override it so that it saves and then preview link opens in the same … Read more

Working with Next and Prev links in Single Taxonomy Templates

I am building an art gallery website using a custom post type “paintings”. There is a custom taxonomy for categories called “painting_cat” where it can be “studio”, “plein air” etc., and another custom taxonomy called “series” so that paintings that are part of a series can be grouped together. Paintings can be in both a … Read more

Using previous_post_link and next_post_link to wrap around post sequence

For a single custom post type, I’m using previous_post_link and next_post_link with simple arrows. (Although text arrows are shown here, in the actual I’m using graphics with the text hidden via CSS.) Code: <nav class=”arrowNav”> <div class=”nav-previous”> <?php previous_post_link(‘%link’, ‘«’); ?> </div> <div class=”nav-next”> <?php next_post_link(‘%link’, ‘»’); ?> </div> </nav> This works fine except for … Read more

Showing Thumbnail from Previous and Next Posts

Is there a simple way to use the post thumbnail when calling previous_post_link() and next_post_link()? 1 Answer 1 This could be acheived by using the get_previous_post() and get_the_post_thumbnail() functions. Then just pass the thumbnail value into the second parameter of previous_post_link(). $prevPost = get_previous_post(); $prevThumbnail = get_the_post_thumbnail( $prevPost->ID ); previous_post_link( ‘%link’, $prevThumbnail );

Post in Multiple Categories to stay in current category (permalink, next previous post link)

I guess this has been mentioned before, but after 2 days of browsing i haven’t find a complete solution. Maybe someone has come across this problem before? I’m building a designer portfolio where posts are assigned to more than one categories. Permalinks are set in the form of: portfolio.com/category-name/post-name/ Example: Post 1 Assigned to Category … Read more

WordPress previous_post_link exclude posts with multiple categories

I have a single-news page in WordPress where I am looping over all the posts and conditionally updating the previous and next buttons to exclude certain categories based on the current post’s category ID. Here is what I have: <?php if (have_posts()): ?> <?php while (have_posts()): ?> <?php the_post(); ?> <?php if ( in_category(7)) : … Read more

adding custom fields to next and previous post link

Im trying to make my next and previous post buttons display my custom field but for some reason it doesnt display the custom field its just blank. Heres my code. <div id=”next-prev-links”> <?php $previous_post = previous_post_link(‘%link’, ”.$image_prev.”, TRUE); $next_post = next_post_link(‘%link’,”.$image_next.”, TRUE); $image_prev = get_post_meta( $previous_post->ID, ‘image’, true); $image_next = get_post_meta( $next_post->ID, ‘image’, true); ?> … Read more

Why is previous_post_link and next_post_link working outside of the Loop?

This is my single.php file: I’m using previous_post_link(); and next_post_link();. In the Worpress codex it says that it only works inside the loop. <?php /** * The Template for displaying all single posts. * * @package WordPress * @subpackage Starkers * @since Starkers 3.0 */ get_header(); ?> <?php get_sidebar(); ?> <div id=”content”> <?php // Create … Read more