how to hide or disable some part in specify page

You want to “reverse” your logic, in a sense. You need “not (home or front)”, not “not home and not front”. For example: // var_dump(is_home(),is_front_page(),(is_home() || is_front_page()),!(is_home() || is_front_page())); // debug if ( !(is_home() || is_front_page()) ) { echo “Hello World”; } else { echo “Else World”; } An easier, more readable way to write … Read more

php return username of currently viewed author profile

On an author archive page (assuming the plugin uses the core archives) get_queried_object() will return the WP_User object for the author. Something like: $author = get_queried_object(); if (is_a($author, ‘WP_User’)) { var_dump($author->data); } You should see the login, nicename, and display name in there. Use what you need.

Make post title active

Your current code relies on time travel to work: $IDOutsideLoop = $post->ID; global $post; Specifically the first line is peering into the future, how can it know what $post->ID is if it’s undeclared? The fix is global $post;, but when the computer gets to that line, it’s too late global $post; $IDOutsideLoop = $post->ID; If … Read more

Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS

I wanted to achieve the same thing.. What I ended up doing was creating a function that collects the Kirki variables (see here about the use of variables in Kirki) and writes them to a scss.. $file = get_template_directory() . ‘/sass/custom/_custom_vars_mixins_options.scss’; if(file_exists($file)){ $output = “”; $variables = Kirki::get_variables(); foreach ( $variables as $variable => $vvalue … Read more

How do I check if there is a tag in the title

Put this in your loop: <?php $title = get_the_title(); $posttags = get_the_tags(); if( $title && $posttags ) { $result = find_tag_in_title( $title, $posttags ); var_dump( $result ); // dump result } ?> Put this in your functions.php file: <?php function find_tag_in_title( $title, $posttags ) { foreach( $posttags as $tag ){ if( strpos( strtolower($title), strtolower($tag->name) ) … Read more

WordPress call post-ID in jquery

This question is more of a js/jQuery is then WordPress. I am not going to post a working answer as It is hard to read the html given. And I think how you are doing it is not a effective solution. My answer should guide you towards better solution. First of all you do not … Read more

How to display meta_value array?

The SQL you want would be: $sql = ” SELECT DISTINCT post_id FROM $wpdb->posts, $wpdb->postmeta where $wpdb->postmeta.meta_value=”2015/06/03″”; $results =$wpdb->get_results($sql); But there is no reason to be involving the $wpdb->posts table at all, since the post_id value is a $wpdb->postmeta table column. $sql = ” SELECT DISTINCT post_id $wpdb->postmeta where $wpdb->postmeta.meta_value=”2015/06/03″”; $results =$wpdb->get_col($sql); Note that I … Read more