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’ );

How to remove some item from WordPress Dashboard for user Author

Two edits: checking for a role is not recommended, you want to check for a capability instead; and the php file you want to pass is edit-comments.php. <?php add_action( ‘admin_menu’, ‘my_menu_links_removing’, 999 ); function my_menu_links_removing() { if ( ! current_user_can(‘activate_plugins’) ) { remove_menu_page( ‘edit-comments.php’ ); } } ?> Administrators are the only default role (besides … Read more