Need 404 behaviour for blank parent page

In functions.php function productsPageRedirect_404() { global $post; if( is_page(‘products’) ) { global $wp_query; $wp_query->set_404(); status_header(404); } } add_action( ‘wp’, ‘productsPageRedirect_404’ );

Do I have to widgetize my pages?

Use page templates and template parts. On your Front Page, you include the Texts as Template Parts: Front Page +—————+—————+—————+ | Page A | Page B | Page C | +—————+—————+—————+ | Link Page 1 | Link Page 2 | Link Page 3 | | Text 1 (TP1*) | Text 2 (TP2*) | Text 3 … Read more

Allow a user to edit their own page and profile only

Read the WordPress Codex on the subject of Roles http://codex.wordpress.org/Roles_and_Capabilities To confirm that the system works the way you want, as an admin create a test member with the author role and sample content as you would for a ‘real’ member. Then sign out and sign in using your test member’s credentials and see what … Read more

Displaying posts on homepage – Template Page

The template tags (like the_content()) aren’t available when using get_posts. In order to make the template tags available, you have to make use of setup_postdata( $post ); Example: <?php $posts = get_posts(‘category_name=category-test’); foreach($posts as $post) { setup_postdata( $post ); the_title(); ?> <p><?php the_content(); ?></p> <?php } ?>

Best way to organize data in this scenario

I vote for having two separate pages since this gives you all the power of permalinks that go directly to a specific video. That’s much better for you and your visitors since the content can be more easily shared. From the codes perspective, you can apply DRY principles and still use a single-video.php and archive-video.php … Read more

append one page content into another

You can use get_post_field() for getting the post fields i.e. Title, Content etc. // Replace $post_id with the ID of your post/page <?php get_post_field( post_title, $post_id); get_post_field( post_content, $post_id); ?>

Remove Duplicate Pages so only original exists

As you assure me that the post title is an accurate indicator of the “duplicate” status of the post, a little bit of SQL and wp_delete_post() will do it: $sql = “SELECT ID FROM {$wpdb->posts} WHERE post_title REGEXP ‘^.*-[[:digit:]]*$’ AND post_type=”page””; $del = $wpdb->get_col($sql); foreach ($del as $d) { wp_delete_post($d); } As written, your duplicates … Read more

Undefined index: post in NOTICE while adding meta box

You get that error, because the $_GET and $_POST are not filled on every admin page with that data. Also, your code should never rely on globals, they can be changed by any other code, so they are not reliable. So don’t use global $post;, $_POST or $_GET when you can get the information from … Read more