Wordpress obtains the parameters of the previous article.

Source: Internet
Author: User
Obtain the previous article: previous_post_link () and the next article: next_post_link () parameters: 1. The current article is under the same category. 2. If the title, link, and special image of the previous article are only parameters 1, there are official examples: {code ...} I wonder if there is any way...

Get previous article: previus_post_link (), get next article: next_post_link ()

Parameters:
1. Current articles under the same category
2. Title, link, and special image of the next article

If only parameter 1 is used, an official example is provided:

I wonder if there is any requirement for obtaining parameter 2.


The two thumbnail images are the special images of the previous and next articles on WordPress. the_post_thumbnail (); the title and link below are called by the above Code, the special image is manually tuned. I want to automatically call the special image and link address of the previous or next article.

Reply content:

Get previous article: previus_post_link (), get next article: next_post_link ()

Parameters:
1. Current articles under the same category
2. Title, link, and special image of the next article

If only parameter 1 is used, an official example is provided:

I wonder if there is any requirement for obtaining parameter 2.


The two thumbnail images are the special images of the previous and next articles on WordPress. the_post_thumbnail (); the title and link below are called by the above Code, the special image is manually tuned. I want to automatically call the special image and link address of the previous or next article.

 

ID);?> "> ID, '','');?> Previous: ID);?> "> Post_title;?>

ID);?> "> ID, '','');?> Previous: ID);?> "> Post_title;?>

Good guys do it to the end.
Let's take a look at the changes.

function nav_link_with_thumb(){         $output = '';         $prev_post = get_previous_post();         if ($prev_post){          $output .= get_the_post_thumbnail($prev_post->ID, 'thumbnail');             $prev_post->filter='sample';             $output .= 'Previous Post: '.$prev_post->post_title.'';         }         $next_post = get_next_post();         if ($next_post){             $output .= get_the_post_thumbnail($next_post->ID, 'thumbnail');             $next_post->filter='sample';             $output .= 'Next post: '.$next_post->post_title.'';         }         echo $output;}

Can tabs be supported?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.