Tag Info

Hot answers tagged

6

It looks like your site's title is empty. Fill it out or try for example: add_filter( 'wp_title', function( $title ) { return trim( $title ); } ); to remove the blank space in front. For your setup, the following part of wp_title() is responsible for the blank space: $title = $prefix . implode( " $sep ", $title_array ); So when you're on a single ...


3

From the Codex If you are using a custom homepage with custom loops and stuff or a custom front-page, you will have an empty wp_title. Here goes a neat hack to add the description/tagline at the wp_title place on homepage: add_filter( 'wp_title', 'baw_hack_wp_title_for_home' ); function baw_hack_wp_title_for_home( $title ) { if( empty( $title ) ...


2

Found the following solution which works to remove the content editor from all "page" content. Just chuck it in the functions.php file add_action('admin_init', 'remove_textarea'); function remove_textarea() { remove_post_type_support( 'page', 'editor' ); }


2

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want Close to this: while ( $query->have_posts() ) : $query->the_post(); if (is_page) { $pageTemplate = basename( get_page_template() ); echo "<p class=\"" . $pageTemplate . "\">" . ...


2

You could hook the page_template filter and check if the current page has a _wp_page_template meta key. If it does, you can check if file_exists in the new templates location, then update_post_meta to append the new directory name.


2

I would recommend using the category_template filter - just check if the current category is an ancestor of 67: function wpse_179617_category_template( $template ) { if ( cat_is_ancestor_of( 67, get_queried_object_id() /* The current category ID */ ) ) $template = locate_template( 'category-slider.php' ); return $template; } add_filter( ...


2

This is the code I'm using, it's a custom nav walker for BootStrap but you could easily adapt it to your own. By the way, you could copy & paste my nav walker and be sure to change this line: $class_names .= ' dropdown'; to $class_names .= ' sub-menu'; Hope this helps. /** * Custom Bootstrap Nav Walker */ class macho_bootstrap_walker extends ...


1

Remove query_posts and add a pre_get_posts action to your functions.php file to modify sort order: function wpd_category_sort_order( $query ) { if ( !is_admin() && $query->is_category() && $query->is_main_query() ) { $query->set( 'order', 'ASC' ); } } add_action( 'pre_get_posts', 'wpd_category_sort_order' );


1

My solution to this problem when extending the Walker_Nav_Menu was to skip check if current_page_parent when C.P.T. I identified C.P.Ts following this stackexchange post. This does not entirely solve the problem as I am using current_page_item for C.P.T parent menu items, but it does achieve the desired outcome. Here is my class. class My_Menu extends ...


1

Custom fields can accomplish what you're trying to do. http://codex.wordpress.org/Custom_Fields You define the custom key and values in an edit page, and then you can re-use them in other edit pages. Once defined, you need to display the custom fields in your template(s). The documentation isn't super clear, but if your key was "currently_reading", your php ...


1

You could develop your own metabox for the page (with custom styling, probably) that allows selection of the template. I don't know that generating screenshots is feasible, but you could definitely have it pull from some sort of associated file (eg: template name is template-name.php, screenshot is template-name.png). With the replacement selection method ...


1

If you wrote in a conditional on the home.php or index.php couldn't you loop through with get_template_part(); ?


1

When working with shortcode you must return a value rather than output directly. The below amendmetn should fix your positioning issue. For more informaiont, see the Shortcode API Codex, speciffically the Output section. function multipage_form() { global $wpdb; $this_page = $_SERVER['REQUEST_URI']; $page = $_POST['page']; ...



Only top voted, non community-wiki answers of a minimum length are eligible