displaying child pages in columns when on a parent page
displaying child pages in columns when on a parent page
displaying child pages in columns when on a parent page
Yes it is possible using get_template_part(); Assuming that you use a standard single.php: <?php /* * Template name: template-blog-left * */ get_header(); ?> <div id=”left-sidebar”> <!– Here your left sidebar –> </div> <div id=”content”> <?php //This function will look for single.php file in your theme folder get_template_part( ‘single’ ); ?> </div> <?php get_footer(); ?>
$prev = get_previous_post(); $next = get_next_post(); $prev_title = $prev ? get_the_title($prev) : ‘Current is First Post’; $next_title = $next ? get_the_title($next) : ‘Current is Last Post’; See get_previous_post and get_next_post on Codex for some details and additional params you can use.
Create a subfolder in plugins folder, name it ‘MyRestict’. In This folder put the following php: <?php /** * Plugin Name: My Restict * Plugin URI: http://wordpress.stackexchange.com/questions/112566/how-to-set-different-users-for-different-pages * Author: G.M. */ function my_restict_template_filter( $template ) { if ( is_page() ) { $post = get_queried_object(); $allowed = (string) get_post_meta($post->ID, ‘allowed_users’, true); if ( $allowed ) $allowed … Read more
For that you can create two templates and assign both templates to both pages. Add those pages to menu and give them both the label Home. Now its working like your site has a two home pages.
Can’t select a page using is_page()
Dynamic content in pages
If you’re trying to do this just for anchor links within your current WP page, a table of contents style plugin will likely suffice; for example, see: http://wordpress.org/plugins/table-of-contents-plus/ This specific example auto-generates the table of contents and anchors based on the headers in your document/page, so it is fairly low fuss on you as the … Read more
Doesn’t seem like you are using an if-statement for showing the sub-pages? If you are not, I guess you can do it with jQuery. var sub = $(“div.subpages”); if (sub.length > 0) { $(“#secondary”).hide(); // replace “secondary” with the ID of the sidebar }
The database hasn’t been queried yet on init, there is no $post or $wp_query. See the Action Reference for the order actions are executed. Try moving your code to the template_redirect action.