0

Regardless of it being WooCommerce or WordPress, I want to add a couple articles to specific pages, so they show there instead of the images that are there now. Homepage I know, I'm supposed to use shortcodes for that, but for some reason I can't get it to work. For example: This one has post ID 1305, so you'd imagine I use

[display-posts id="1305"]

to show it on that page, but it only displays the shortcode itself. I thought displaying posts by shortcode was one of WP's basic functions, wasn't it? Do I have to code a custom shortcode just for this to work?

Any advice?

1
  • since it wouldn't work for some reason, I ended up using a plugin for it. – theHubi Dec 12 '14 at 9:39
0

If you want to put PHP code in the editor you need a plugin, same goes for display-posts.

Display Posts shortcode isn't a built in function. https://wordpress.org/plugins/display-posts-shortcode/

-1

Try this

<?php echo do_shortcode('[display-posts id="1305"]'); ?>
1
  • nothing. Now (since I removed the image to show only the article) it displays nothing. For your information, I added it in the backend - edit page. Afaik it should take PHP code as well. I suppose I could try adding it to the page-template. – theHubi Dec 12 '14 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.