如何在wordpress中的单个页面中显示特定帖子?

I want to know if it's possible to display specific posts when I click on a link from a specific page to the (ex: gallery page).

Example: Let's say I have 3 posts with 3 different galleries. (post 1=wedding pictures / post 2=food pictures / post 3=dogs pictures) and I also have 3 pages.

When I'm on Page 1 and click on the gallery page link, I want to only show post 1 content (only wedding pictures). When I'm on Page 2 and click on the gallery page link, I want to display only the post 2 content.

If It's possible what would be the most simple solution?

Thank you!

You can first assign each photo (or post containing a photo) a category e.g. Wedding, food etc. Once that is done, create a custom menu and add the categories to it. Place this menu on an area of your page and give it a try. It should only show the required images/posts.

For more info, you can have a look at the link below: https://en.support.wordpress.com/category-pages/

Note: You may need a plugin to allow you to place categories on images. Have a look at an example at the link below: https://wordpress.org/plugins/categories-images/

To show specific posts based on type, category, tag or any other property, your best bet is to use a shortcode, which gives you lots of versatility in how to render the items (in a post, page, widget, template file, etc).

The shortcode could be generated by a plugin such as Bill Erickson's Display Posts, Content Views or 10's of other plugins.

Or do it manually by building your own "show some posts" shortcode and get a much better understanding of WP. You'll have to build your own html output, filters and paging, but you will end up with less plugins gumming up your installation. There's lots of tutorials for this, search for "Wordpress display posts shortcode functions.php".

E.g. Placing the following in your theme's (ideally, a child theme) functions.php file, here is a way to show a specific number of posts from a specific content type:

Place in functions.php:

function show_some_posts($atts) {

  $a = shortcode_atts([
    'post_type' => 'post',
    'posts_per_page' => 3
  ], $atts);

    $the_query = new WP_Query( $a );

    if ( $the_query->have_posts() ) {

        $string .= '<ul>';

        while ( $the_query->have_posts() ) {
            $the_query->the_post();

            $string .= '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';


        }

        wp_reset_postdata();
        $string .= '</ul>';

    } else {
        $string .= 'no posts found';
    }

    return $string;
}

function shortcodes_init()
{
  add_shortcode('get-posts','get_some_posts');
}

add_action('init', 'shortcodes_init');

And to render the actual list, place this shortcode in your page or post:

[get-posts posts_per_page="3"]