Last active
May 22, 2019 10:33
-
-
Save ambercouch/825af92d4312769318c2e987771b64d1 to your computer and use it in GitHub Desktop.
Wordpress widget logic contidional code to use in widgets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Paste the code below into the widget logic field of you widget and edit the page IDs as needed | |
//The code below will display your widget on pages 8,9 and 10 and any page that is a child of page 8 | |
global $post; return (is_page(array(8,9,10)) || in_array($post->post_parent, array(8))); | |
//The code below will display you widget on pages that us the faq-page.php template file | |
global $post; return (get_page_template_slug( $post->ID ) == 'page-templates/faq-page.php'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment