• I’m not fluent in code. I’ve tried to figure this out on my own and just can’t. Can someone please piece this together for me??

    I need to hide the Floating Social Media Links widget only on the theme’s microsite template.

    I found a year-old post where the plugin author said there isn’t a way to do this aside from editing php, but didn’t give the php code to use.

    From the read-me file:

    If you are, siply copy this code: <?php floating_social_media_links() ?> and paste it into each template file that is used for the pages that you want [the widget to appear]

    But I don’t want to edit every single page type. I just want to stick one piece of code into the microsite page template php file.

    Could someone please help? Thank you in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    The problem is when you add a widget to a sidebar, that widget appears where ever the sidebar appears. If there’s nothing else in the sidebar you could remove the sidebar from the one template. Otherwise you’d need to declare a custom widget that is coded to not output content on a particular template, or create a new sidebar for use only on the one template that does not contain the widget. Neither of these last two options is trivial.

    Another possibility is remove the widget, then go into each template except microsite page template and add the <?php floating_social_media_links() ?> near the dynamic_sidebar() call. It may not be possible for it to be placed exactly where it is now with this approach.

    If you have to hide in a page template simply use the following code.

    if ( ! is_page_template( 'template-microsite.php' ) ) {
    	floating_social_media_links();
    }

    I hope this will help you.

    If you have to hide in a page template simply use the following code.

    if ( ! is_page_template( 'template-microsite.php' ) ) {
    	floating_social_media_links();
    }

    I hope this will help you and don’t forgot to change php file name as you have.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need php code to hide widget on certain pages’ is closed to new replies.