Tag Info

New answers tagged

0

To expand upon my comment: Top-level page? (q.1) global $post; $x = get_ancestors( $post->ID, 'page' ); if( ! $x ) { // there are no ancestors, therefore this is a top-level page } Childless page? (q.2) global $post; $args = array( 'post_parent' => $post->ID, 'post_type' => 'page', ); $x = get_children( $args ); if( ! $x ) { ...


0

If I understand correctly what you want, you want a 'page in a page'. This is very easy. Just use this plugin. It has support for widgets and shortcodes. Especially the shortcodes will be interesting for you. The plugin description repeats that it's mission is to bring your Facebook posts and Twitter feeds to your blog. You can ignore that, you should ...


1

You are trying to set a cookie after the headers have already been sent. You need to set you cookies at the top of the header template before the doc type deceleration.


0

Reset your permalink from admin site. you may get page if there is a conflation with permalink.


0

We got it working. We used a plugin called the Javascript & CSS toolbox to store our individual code blocks and then we put the html code in the page content pane and it worked brilliantly.


0

get_pages returns an array of post objects, so you would use foreach to iterate over each object and grab the ID and whatever else you want to use: <?php if ( $pages = get_pages( $args ) { echo "<select multiple>"; foreach ( $pages as $page ) { echo "<option value='{$page->ID}'>{$page->post_title}</option>"; } ...


0

You can store the result in an array like so: $children = wp_list_pages( $args ); And then iterate through them like so: foreach ($children as $child) { if ($child->ID == $ID_OF_PAGE_THAT_SHOULD_BE_PDF_LINK) { echo $YOUR_PDF_LINK; } else { /* Whatever else you wanted to echo */ } }


1

You could use template_include conditionally. add_filter( 'template_include', 'wpsites_photo_page_template', 99 ); function wpsites_photo_page_template( $template ) { if ( is_category('33') ) { $new_template = locate_template( array( 'photo.php' ) ); if ( '' != $new_template ) { return $new_template ; } } ...


0

Well, the template hierarchy allows you to use a custom template file for categories. http://codex.wordpress.org/Template_Hierarchy#Category_display If you want a special template for the category 33, you just save the template file as category-33.php in the theme folder. Happy Coding, Kuchenundkakao


0

Sounds like what you need is a page template. This will allow you to enter your PHP (and any other code) in the appropriate place to generate the content on the frontend. Starting with a copy of your theme's current page.php file is usually a good place to start. Modify the main area with your code, upload the file and select it as the page template in ...


0

The publish_page action is listed as deprecated. You can use the 'transition_post_status' hook to check if a page was published. function publish_page_interception( $new_status, $old_status, $post ) { if ( ($new_status != $old_status) && ($post->post_status == 'publish') && ($post->post_type == 'page') ) { ...


0

Use the Post Object instead. When in the loop, do this: global $post; echo $post->post_name; That should do the trick.


-1

You'll want to register your own custom post type. Rather than try and get your head around how to do this properly (as referenced in other answers), I'd recommend you add this to your functions file and adjust as needed: function custom_post_type() { // Set UI labels for Custom Post Type $labels = array( 'name' => _x( 'Staff', 'Post ...


-3

There's a great plugin for creating and editing menu items in the wp-admin. Check it out here: https://wordpress.org/plugins/admin-menu-editor/ You can create custom menu items with that. You may also need to create a custom post type or a page with the text or content on it that you want the new menu link to load. It's good practice to use plugins for ...


1

Not as vague as you might think. This is a very commonly used approach. What I would suggest you focus on is creating a custom post type. This will give you the admin menu item, categories (or any taxonomy structure you like) and many other features. CPTs are very simple to register and modify. They are perfectly suited for storing data such as products ...


1

In the link all the content such as calendar, categories, archive, etc. are coming from the sidebar widget which most probabily defined into your page.php layout. something like: <?php get_sidebar( 'content' ); ?> You need to remove this kind of sidebar code from the page.php file to not display that information.


1

My guess is that you have not defined a page.php template in your theme, so pages are being displayed using index.php which includes a sidebar with widgets and comment form. Edit: Looking at the code in your updated question, you can remove the following: // If comments are open or we have at least one comment, load up the comment template. if ...


1

There's a plugin which does this perfectly: http://wordpress.org/plugins/post-tags-and-categories-for-pages/


0

There is also a straightforward CSS solution to override WordPress’s inline styling. .wp-caption { display: table-cell; width: auto !important; } Setting the width to auto on a block element would result in its width expanding to fill the available space, which is probably not what is wanted, but setting display: table-cell causes the div to ...


1

Your search form includes this: <input type="hidden" name="post_type" value="postpage" /> So when your search page loads, the query variable 'post_type' is set to load posts of type 'postpage'. Since posts are of type 'post' and pages are of type 'page', neither of which are 'postpage', you do not get what you expected. Next time, don't use ...


0

<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post"> <input type="submit" name="user_info_form" id="user_info_form" /> </form> I think there is a syntax error in the PHP. It should end with a semicolon, like this: <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post"> <input type="submit" ...


0

add this code to your fnctions.php. working of the code is given below. function wpb_list_child_pages() { global $post; if ( is_page() && $post->post_parent ) $childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' .$post->post_parent . '&echo=0' ); else $childpages = wp_list_pages( ...


0

I've got a class on Gist that will create a full secondary TinyMCE post editor which will look and function exactly like the original editor complete with toolbar, support for shortcodes, etc.. Just drop it into your theme and assign the post_type which should display the editor. You can then call the content saved to the secondary editor with the function ...


0

You have mix up in static and non-static usage. Your style is non-static, but your methods are declared as such. If you enable WP_DEBUG mode you'll see following errors: Notice: Undefined variable: this Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object This happens ...



Top 50 recent answers are included