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

How do I register a new settings page? [closed]

you can try a code like this <?php function theme_settings_init(){ register_setting( ‘theme_settings’, ‘theme_settings’ ); } î This is used to reserve a name for a custom settings array //Add settings to page menu function add_settings_page() { add_menu_page( __( ‘Contenu éditable’ ), __( ‘Contenu éditable’ ), ‘manage_options’, ‘settings’, ‘theme_settings_page’); } î This will create the page … 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); ?>

How to create plugin auto create page wordpress?

The following hook is called when the plugin is activated from the dashboard. register_activation_hook( __FILE__, ‘myplugin_activate’ ); function myplugin_activate() { //create a variable to specify the details of page $post = array( ‘post_content’ => ‘content’, //content of page ‘post_title’ =>’title’, //title of page ‘post_status’ => ‘publish’ , //status of page – publish or draft ‘post_type’ … Read more

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

List all posts, pages and custom post types in admin

There is nothing build-in to create the drop-down for you, so you have to do it yourself. To get the needed information you can use get_post_types() to get the post types you want, set the $args parameter accordingly. Additionally you can set the $ouput parameter to objects, if you need the data provided – it … 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