Using is_page() in functions.php not working at all

Trying to run a custom script on a single page using is_page in functions.php not working at all. I have a function called load_gh_boards that would enquque a script, only on a certain page (79): function load_gh_boards() { if( is_page(79) ){ wp_register_script( ‘gh-jobs-board’, get_bloginfo( ‘template_directory’ ) . ‘/js/gh-jobs-board.js’, array(), ‘1.0’, true ); }} add_action(‘wp_enqueue_script’, ‘load_gh_boards’); … Read more

How to check if a post “does not have term” in conditional statement?

We know that we can check if the particular post has a term by using this code: has_term(‘term’, ‘taxonomy’, $post->ID )) { I was wondering if there is a code to check if a particular post does not have a particular term. Thanks. 2 Answers 2 if ( !has_term(‘term’, ‘taxonomy’, $post->ID )) { Use the … Read more

Post tags show outside loop?

I’m trying to use tags of the single post, as meta keywords. I tried using this: <meta name=”keywords” content=”<?php the_tags(”,’,’,”);?>test<?php }?>”/> It works, but the output is: <meta name=”keywords” content=”<a href=”http://127.0.0.1/1/tag/aquaman/” rel=”tag”>aquaman</a>,<a href=”http://127.0.0.1/1/tag/batman/” rel=”tag”>batman</a>,<a href=”http://127.0.0.1/1/tag/wonder-woman/” rel=”tag”>wonder woman</a>”/> Is it possible to remove the tags link/URL? And just the text/tag itself will appear? 2 Answers 2 … Read more

Conditional based on the User Role of the Current Profile the user is viewing – BuddyPress [closed]

Closed. This question is off-topic. It is not currently accepting answers. Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic. Closed 7 years ago. Improve this question I’m using BuddyPress … Read more

Adding Controls to Theme Customizer If Certain Page Template is Active

How to Conditionally add controls on Theme Customizer panel. Conditional like is_page() or is_page_template() obviously does/will not work because the page is being shown is customize.php. Code Example add_action( ‘customize_register’, ‘my_theme_customize_register’, 11 ); function my_theme_customize_register($wp_customize){ if( is_page_template(‘my-template.php’){ // add special control } } Another observation is, customization setting control panel does not refresh when we … Read more

Conditionally loading Facebook PHP SDK in shortcode

Since 3.3 we can enqueue scripts conditionally right in our shortcode functions, but when I tried to do this with some PHP class (uses session_start() in the __construct() function) as you can guess it gives me the headers already sent error. The problem is (this is using the Facebook PHP SDK in conjunction with the … Read more