Problem with calling custom function in a foreach loop

First you need to pass the post_id to this function to use the post_id inside the get_the_category($post_id) function incomplete_cat_list($post_id = ”) { global $post; $post_id = ($post_id) ? $post_id : $post->ID; $first_time = 1; $categories = get_the_category($post_id); foreach($categories as $category) { if ($category->cat_name != ‘Category Name’) { if ($first_time == 1) { echo ‘<a class=”cat-list” … Read more

Genesis Framework: How to exclude a specific author from archive custom loop

You can do it with the pre_get_posts hook. In WP_Query there is an author parameter : https://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters pre_get_posts hook : https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts function wpse_288986_remove_post_from_author($query) { // We have to check if we are in front and if the query is the main query if(!is_admin() && $query->is_main_query() && is_archive()) { $query->set(‘author’, -2); // Where 2 is your … Read more

Theme JS is available but theme CSS isn’t

It seems to me best to separate styles, from scripts and other assets. This worked: function my_theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, get_parent_theme_file_uri() . ‘style.css’ ); } add_action( ‘my_theme_enqueue_styles’, ‘wp_enqueue_styles’ ); function my_theme_enqueue_assets() { wp_enqueue_script( ‘behavior’, get_theme_file_uri( ‘behavior.js’ ), array(), null, true ); } add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_assets’ );

WordPress check if current taxonomy has child

There is solved: $taxonomy_name=”listing_category”; $queried_object = get_queried_object(); $term_id = $queried_object->term_id; $termchildren = get_terms( $taxonomy_name, array( ‘parent’ => $term_id, ‘hide_empty’ => false ) ); echo ‘<ul>’; foreach ( $termchildren as $child ) { echo ‘<li><a href=”‘ . get_term_link( $child, $taxonomy_name ) . ‘”>’ . $child->name . ‘</a></li>’; } echo ‘</ul>’;

Open and closed function [closed]

$open = “our lines are open”; $closed = “our lines are closed”; if ( time() >= strtotime( ’09:00:00′ ) && time() <= strtotime( ’17:00:00′ ) ) { echo $open; } else { echo $closed; } Somethinh like this should help you.