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 – Pratik bhatt Dec 29 '18 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? – Sergey Kiziev Dec 29 '18 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 '18 at 16:25

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. – Sergey Kiziev Dec 29 '18 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) – Lukasz Formela Dec 29 '18 at 17:44

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.