What I want to do is make my Home Page. I can do it this way:

  1. Create a page and insert my gallery from plugin with that code [wonderplugin_gridgallery id=1]

  2. Set that page as HomePage.

BUT THAT IS NOT WORKING. When I add this code [wonderplugin_gridgallery id=1] to my page, I can see only code… The same doesn't work <?php echo do_shortcode('[wonderplugin_gridgallery id=1]'); ?> (hidden).

How to fix it? I don't know how to find the file to fix in FTP. Themes Virtue.

I hope you understand what I am writing about. Thank you in advance.

  • This is code for a plugin make sure you have plugin added and activated Dec 29, 2018 at 9:55
  • @Pratikbhatt, Yes activated. In file front-page.php it's written there <?php $post_id_286 = get_post( 286 ); echo $post_id_286->post_content; ?> this is for the main page (homepage). It turned out there does not work shortcode. The post works, the main page is not. You understand? Dec 29, 2018 at 10:06
  • Your theme should output content with the_content() function, the attached filters are what properly process the output to make shortcodes work.
    – Milo
    Dec 29, 2018 at 16:25

2 Answers 2


Depending on what post editor you are using:

  • Classic - make sure to switch the editor to "Text" instead of "Visual". The latter will output anything you write in a form of text, while the first one will process the shortcode.
  • Gutenberg - find a plus sign in the top-left area of your WordPress dashboard and add a "Shortcode" block.

If you add the shortcode manually to the file, make sure it's before the closing PHP tag: ?>

  • in file only <?php $post_id_286 = get_post( 286 ); echo $post_id_286->post_content; ?>, but the shortcode <?php echo do_shortcode('[wonderplugin_gridgallery id=1]'); ?> i don't know where to insert tell me please. And Classic and Gutenberg do the same (add a "Shortcode" block) - does not work i can see only code (text). The post works, the main page is not. You understand? I'm writing above comments by another author. I hope you have already read. Dec 29, 2018 at 13:28
  • Are you sure you are viewing this particular file on your WordPress website? Is the post #286 displayed there? If you add the following code before closing PHP tag in front-page.php file, can you see any new content? var_dump($post_id_286) Dec 29, 2018 at 17:44

If you have the following code in your template:

<?php $post_id_286 = get_post( 286 ); echo $post_id_286->post_content; ?>

then you should can the do_shortcode function to process shortcodes. Do it like this:

<?php $post_id_286 = get_post( 286 ); echo do_shortcode($post_id_286->post_content); ?>

This helped in my case. Hope it will help you too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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