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’ );
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’ );
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
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
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 } ?>
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
Change Settings -> Permalinks to Post Name. Go to your page and edit the Permalink field below the title field.
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); ?>
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
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
The solution was straightforward, though it took me forever to find it. The website has a “Members” plugin (by Justin Tadlock) and the option “Redirect all logged-out users to the login page before allowing them to view the site.” was checked. So I just unchecked that box, problem solved.