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

Manage content on multiple pages synchronysly?

To use a separate single post template for each category, you will need to add the following function in your functions.php: /** * Define a constant path to our single template folder */ define(SINGLE_PATH, TEMPLATEPATH . ‘/single’); /** * Filter the single_template with our custom function */ add_filter(‘single_template’, ‘my_single_template’); /** * Single template function which … Read more

Order by modified date working in POSTS but not PAGES

Check the documentation for the Plugin API/Filter Reference Looks like you need to duplicate your actions and filters for manage_pages_custom_columns/manage_edit-page_columns etc etc. Fair warning: I’ve not vetted this. See below https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_edit-post_type_columns https://codex.wordpress.org/Plugin_API/Action_Reference/manage_pages_custom_column Here’s the resulting code that works: // Custom Functions to add SORT BY MODIFIED to post and page editor. // POSTS // Register … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)