Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8296

    ld1975
    Participant

    Hello,

    how can I insert the slider-shortcode into a header.php?

    Best regards

    Ljubomir

    #8298

    Intense Visions
    Keymaster

    Ljubomir,

    In order to add the slider shortcode into your header.php file, I would suggest doing the following.

    1. Make sure you’re using a Child Theme so your changes don’t get overwritten with a theme update.
    2. Create a Snippet (Custom Post Type with Intense) with the Slider shortcode you want to use.
    3. Use the Snippet shortcode in the header.php file so that the shortcode is smaller and you can modify the slider shortcode without always having to modify the header.php file. Here is an example of what a Snippet shortcode might look like: [intense_snippet snippet_id="2526" snippet_title="Common Hover Effects"]
    4. To place the shortcode in the header.php file, you have to use the following format (this uses the same shortcode from above):

    echo do_shortcode( '[intense_snippet snippet_id="2526" snippet_title="Common Hover Effects"]' );

    You may have to wrap the above in the PHP tags if you are writing the shortcode between HTML:

    <?php echo do_shortcode( '[intense_snippet snippet_id="2526" snippet_title="Common Hover Effects"]' ); ?>

    The reason I suggest using a Snippet is because you can then easily just modify the snippet post and it will work properly without having to always modify the header.php file directly. Snippets are typically meant for things that are used multiple times, making it so that you don’t have to update the same code in multiple places.

    I hope this helps get you going.

    Thanks!

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

You must be logged in to reply to this topic.