Target specific position for custom content

Hi there, I know this is a deep development question, but I’m only searching a little help from you.

I have needed to display custom content (a post of a specific category) in a specific place inside a page.

I know how to create custom hook to target the desired location, but since I’m generating content with WPBakery Page Builder, I don’t know how to target a specific position among the x-content-band(s) of the page.

Can you help me to reach this result? Thank you very much

Hey Alessandro,

Regretfully, there is no hook available for the builders’ content or within the builders including Visual Composer. Hooks are only available for certain theme parts.

Since you have some development knowledge, I’d recommend that you create your own Visual Composer element. See https://visualcomposer.com/blog/how-to-create-custom-elements-using-visual-composer-api/

Thanks.

Hi there, thank you for your suggestion, but I have choose another way, use a custom shortcode so I can put my content where I want. The problem is this shortcode isn’t parsed by the site and I see the plain text

I have followed all the steps to create a custom shortcode:

  • Create the function to execute and save it in a php file that I have put into wp-content folder

  • Include this file in functions.php and register the shortcode with the following lines

        include(content_url() . '/custom-shortcodes.php');
        add_shortcode( "home_post_shortcode_sc" , "home_post_shortcode" );
    

I have checked the function name and it’s correct. Since I’m using WpBakery page builder, I have also tried to register this shortcode inside Shortcode mapper and then put it inside page as a page builder element, but without results.

You can see the shortcode in (no) action here: https://www.e-maxsrl.it/shortcode-test/

Is there another way to use custom shortcode within x-theme?

Can you help me find where is the issue? Thank you very much

EDIT: if I put my function directly inside my functions.php, the shortcode works. But I would like to load it externally for some security reason.

Hey Alessandro,

I’m sorry but this will be veering into custom development which is outside the scope of our product support. Please consult a third-party developer for this.

Thank you for understanding.

For now I keep my shortcode inside functions.php that works perfectly. Then I’ll try to figure out why it doesn’t work with an external file.

Thank you anyway

You’re welcome. We wish you can figure a solution.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.