Home Forums WoodMart support forum Help with a cutom code

Help with a cutom code

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #629443

    akaber
    Participant

    Hi,

    I am using a code snippet to dynamically display a specific shortcode on the Portfolio archive taxonomy, based on the term ID.

    Currently, the shortcode is appearing above the header, but I need it to display below the Woodmart header and above the main content.

    Could you please advise on the correct hook to achieve this placement?

    Thank you for your assistance.

    function add_shortcode_to_project_cat_template($template) {
        if (is_tax('project-cat')) {
    
            $term_id = get_queried_object_id();
    
            $shortcodes = [
                8 => '[html_block id="4914"]', 
                9 => '[html_block id="1234"]', 
            ];
    
            add_action('get_header', function () use ($shortcodes, $term_id) {
                if (array_key_exists($term_id, $shortcodes)) {
                    echo do_shortcode($shortcodes[$term_id]);
                }
            });
        }
        return $template;
    }
    add_filter('template_include', 'add_shortcode_to_project_cat_template');
    
    • This topic was modified 23 hours, 45 minutes ago by akaber.
    #629537

    Hung Pham
    Keymaster

    Hi akaber,

    Thanks for reaching to us.

    Unfortunately, customization is out of our basic support.

    Thanks for understanding our limitations. Let me know if you have any questions.

    Best Regards,

    #629623

    akaber
    Participant

    Hi, I’m not asking for any customization, I just need help locating the correct hook to inject my filter below the WoodMart header and above the main content.

Viewing 3 posts - 1 through 3 (of 3 total)