Unable to run jQuery script in my template file
I don’t think jQuery script is en-queued by default with WordPress templates. So you should place the jQuery script in the header/footer for your code snippet to work.
I don’t think jQuery script is en-queued by default with WordPress templates. So you should place the jQuery script in the header/footer for your code snippet to work.
I would recommend using content-{posttype}.php method, where you only have HTML markup, template tags for posts or custom post types and leave loops outside of those files. See Twenty Eleven for more detailed example. After this change you can easily modify search.php and include specific content markup based on post type. if ( have_posts() ) … Read more
Daniel, exclude parameter doesn’t accept array. Use your code this way: $exclude = []; foreach(get_pages([‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘page-templates/page-noindex.php’]) as $page) { $exclude[] = $page->post_id; } $args = array( ‘exclude’ => implode(“,”, $exclude), ‘title_li’ => ”, ‘sort_column’ => ‘menu_order, post_title’, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’ ); wp_list_pages($args); I think you can refactor it … Read more
If I understand your question, you should use this inside your foreach: $argument_to_pass_to_switch_theme = $theme->get_stylesheet(); Just taking a look at the documentation: The function wp_get_themes()… “…returns an array of WP_Theme objects based on the argument.” This class WP_Theme has a method get_stylesheet(), which… “…returns a string with the directory name of the theme’s “stylesheet” files, … Read more
This if statement is really wrong : if (get_current_user_id()==1 or get_current_user_id()==2 should be : $user_id = get_current_user_id(); if ($user_id==1 || $user_id==2 )
this is just a simple php syntax issue- anything that meets the conditions is_archive() && is_tax(‘question_category’) will also return true for the first if(is_archive()), so you’re code is never reaching that test.
if ( condition ) { get_template_part( ‘path/to/template’, ‘mobile’ ); } else { get_template_part( ‘template’, ‘mobile’ ); // in rootpath } You can also intercept the behavior for get_template_part() with an action hook: // Source in get_template_part do_action( “get_template_part_{$slug}”, $slug, $name ); function wpse21352_template_part_cb( $slug, $name ) { switch ( $name ) { case ‘mobile’ : … Read more
Don’t remove get_header(). Duplicate the header.php to header-{custom-name}.php, let’s say (header-nonavfooter.php) then in the template file replace get_header() with get_header(‘nonavfooter’). In the new header file (header-nonavfooter.php) remove the code related to navigation. Do the same for the footer.php also(Create a new footer.php and remove the footer parts that you don’t need), remember not to remove … Read more
Hook into template_include filter add_filter(‘template_include’, ‘research_term_template’); function research_term_template( $template ) { if ( is_tax(‘classifications’) ) { $parent = get_term_by(‘slug’, ‘oldresearch’, ‘classifications’); // to improve performance you can hardcoding ‘oldresearch’ term id // $parent = 12; if ( term_is_ancestor_of( $parent, get_queried_object(), ‘classifications’ ) ) return get_template_directory() . ‘/taxonomy-Classifications-oldresearch.php’; } return $template; }
how to get the relation between the page and the menu item ? = is there a WP function telling this page is linked to this menu item which has or hasn’t a parent Inside the walker, inside the start_el method (which you mentioned), $item->object_id is the page ID. Otherwise, you need to pull the … Read more