Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8075853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:07:41+00:00 2026-06-05T15:07:41+00:00

In the website every product is a post, but when we add new products

  • 0

In the website every product is a post, but when we add new products we want something like a newsletter, mostly like a post so in the sidebar of the home page you can see the new products or events of the month.

I’m using pages because I don’t want to re-post a product on every new newsletter so I junt wanna display the posts inside the page.

In the products page I separate every product by category and sub-category but since I want to group specific post to publish them on the sidebar I think that pages was the best way to do it.

Right now I’m using this code:

<?php
$productos = new WP_Query(array(
'post__in'=> array(81, 83),
'orderby'=>'title',
'order'=>'ASC'
)
); if ($productos->have_posts()) : while ($productos->have_posts()) : $productos->the_post();
?>

It display the posts with the id of 81 and 83, I would like to show post by slug using ‘name’ as the codex says because is going to take some time to be checking the ids of the new post, instead of using the name of every new product but It doesn’t work in array or I’m doing something wrong.

Now I will love to make something like this work

$names = get_post_meta($post->ID, "names", $single = true); 

$productos = new WP_Query(array(
'name'=> array($names),
'orderby'=>'title',
'order'=>'ASC'
)
);

So every time I publish a new page I just write the slugs of the posts that I want to include in the page in a custom field, as you can see I’m not very good with php but I trying to learn and I search a lot for something that could work before asking in here.

I try the ggis inline post plugin and although it works I need the id for every post I want to include and I will need to edit the plugin because I want a different order in the output of the post thats why I don’t like to depend to much on plugins.

Update:

So I’m now looking if I can make this using shortcodes, right now I have this:

function producto_func($atts) {
    extract(shortcode_atts(array(
        'nombre' => ''
    ), $atts));
    global $post;
    $pieza = get_page_by_title($nombre,OBJECT, 'post');
                echo '<h1>'. $pieza->ID . '</h1>';
}
add_shortcode('producto', 'producto_func');
enter code here

So I just enter the shortcode [producto nombre="ff 244"] in the page and it show its ID, and I can add any number of shortcodes depending on the number of post I need.
But how can I show the entire content of the post.

Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:07:43+00:00Added an answer on June 5, 2026 at 3:07 pm

    I find I solution using Shortcodes.
    So I put this on my functions.php page

    function productos($atts, $content = null) {
        extract(shortcode_atts(array(
            "slug" => '',
            "query" => ''
        ), $atts));
        global $wp_query,$post;
        $temp = $wp_query;
        $wp_query= null;
        $wp_query = new WP_Query(array( 
        'name'=> $slug,
        ));
        if(!empty($slug)){
            $query .= '&name='.$slug;
        }
        if(!empty($query)){
            $query .= $query;
        }
        $wp_query->query($query);
        ob_start();
        ?>
        <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
            <h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
            <div><?php the_content() ?></div>
        <?php endwhile; ?>
    
        <?php $wp_query = null; $wp_query = $temp;
        $content = ob_get_contents();
        ob_end_clean();
        return $content;
    }
    add_shortcode("producto", "productos");
    

    And in my page template I just write [producto slug=”MY-SLUG”] and that way I can display multiple post just with the slugs. Hope someone find this useful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a user-management plugin for grails? Nearly every website requires things like: Users
I have an php website with login form and I want every visitors can
I'm new to nginx and I want to migrate my website from Apache to
In my online store i'm going to manage subscription for the products. Every product
In my website, I want to present to the user the most viewed product
I have a Products class. Now I want to add some kind of discount
I have a website where people can sell products. Each time they add a
I'm making an app which reads the data from a website every interval and
I've encountered a strange bug in Chrome 19. I implemented a full-AJAX website (every
I have an application that needs to check a website feed every second. Sometimes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.