Hot answers tagged

16

Here's a way to support pagination titles of the form: <!--nextpage(.*?)?--> in a simlar way as the core supports <!--more(.*?)?-->. Here's an example: <!--nextpage Planets --> Let's talk about the Planets <!--nextpage Mercury --> Exotic Mercury <!--nextpage Venus--> Beautiful Venus <!--nextpage Earth --> Our Blue ...


5

You can use filter wp_link_pages_link First pass our custom string placeholder (This can be anything you like except string containing %, just for now I am using #custom_title#). wp_link_pages( array( 'pagelink' => '#custom_title#' ) ); Then add our filter in functions.php. In callback function make an array of titles then check for the current page ...


2

Programmatically, you'd be looking for is_user_logged_in(). You'd want to put this in your header.php, or on the page itself: if ( is_user_logged_in() ) { // user logged in, redirect // One way to redirect is: // wp_redirect('http://YOURSITE.com/'); exit(); } else { // user not logged in, nothing } Otherwise, if you're just looking ...


2

I think @Milo's comment is correct. Presumably you want to use functions like current_user_can(), etc. Alternatively, if this is just to show a different menu, you could create a custom menu for remote users then set a cookie on your wordpress site (via a call from the API) and display a different menu to your remote users when authenticated remotely. ...


2

First off, ensure that the category is exactly the same name as the page ( slug and all ). Secondly, the parameters you're passing to WP_Query is incorrect. category_name expects a slug. For example, Page 1 would have a slug of page-1. get_the_title() pulls the current page title - so you're passing Page 1 to a parameter that expects a slug page-1. What ...


1

Your code is invalid (syntax error, missing closing array and semi-colon), and incorrectly nested - if you were to properly indent your code, you'd have something like: $args = array( 'tag' => 'tag-AAA,tag-BBB', array ( 'orderby' => array( 'title' => 'ASC', 'post_date' => 'DESC', ...


1

You can try this: add_filter( 'media_send_to_editor', 'remove_width_height_attribute', 10 ); function remove_width_height_attribute( $html ) { $html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); return $html; }


1

In a theme with no menu locations defined - or a Wordpress install with no menus set up - the default fallback option for menus is to display the output of wp_page_menu(). By default, this will output all of your pages firstly by their order, then by their title if the orders match. This makes it simple to avoid the extra step entirely of configuring a ...


1

Solved I've solved the problem and I'm going to share the code I used, so other developers that have this issue too can cope with it. The get_pages()-function accepts the "hierarchical" argument. By default it's set to 1 (true), which means, that Wordpress searches the pages in hierarchical order to find the other parameters. If - as in my case - you ...


1

http://wordpress.stackexchange.com/a/199997/86773 As the advice suggested here, switching my hook to "wp" instead of "init" allowed me to make the page comparison I wanted using is_page().


1

I use the following for multiple post types, just replace foo and bar with your own post types: $args = array( 'post_type' => array( 'foo', 'bar' ), 'orderby' => 'post_date', // other parameters as needed ); $q = new WP_Query( $args ); if ($q->have_posts()) : while ...



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