Creating and populating custom nav menu (menu-item-position not working)
You don’t set sort_column to menu_order when you call get_pages, so it defaults to sorting on post_title. $pages = get_pages( array( ‘sort_column’ => ‘menu_order’ ) );
You don’t set sort_column to menu_order when you call get_pages, so it defaults to sorting on post_title. $pages = get_pages( array( ‘sort_column’ => ‘menu_order’ ) );
Got it, so I changed the name of the file input from thumbnail to thumbnail[]. Then I wrapped the above paste in a function and added this part at the top of the file and it works perfectly: if ( $_FILES ) { $files = $_FILES[‘thumbnail’]; foreach ($files[‘name’] as $key => $value) { if ($files[‘name’][$key]) … Read more
why don’t you use a shortcode? add the shortcode in the content of that page and then create a function to show that form and include the php file. the user with id 1 is always the super user/admin. I’m not sure but maybe there is a strict validation for other users when adding content … Read more
As far as I know you can’t add the thumbnail in the first array you send to create the post, you’ll need to grab the post ID after the wp_insert_post, then run update_post_meta after the first part of the function. If you post your function here we might be able to help a little further.
Automatically add another subpost of the same parent when a subpost is saved
Just add custom-field support to your custom post; register_post_type( ‘YourPosts’, array( ‘labels’ => array( ‘name’ => __( ‘YourPosts’ ), ‘singular_name’ => __( ‘YourPost’ ) ), ‘public’ => true, ‘has_archive’ => true, ‘supports’ => array( ‘title’, ‘editor’, ‘custom-fields’, ) ) );
Try escaping the apostrophe character, i.e. $question = “If you\’re in need, this is who you call”; Apostrophes have a special meaning in PHP code, which is probably why it’s truncating.
wp_insert_post hook not being called with wp_publish_post or wp_insert_post?
wp_insert_post questions
The ‘wp_insert_post’ action is fired for each post that is inserted and passed the ID of the inserted post to the callback function, so I think your $wpdb query is unnecessary – in fact, I think you’re running the “custom function” portion for all published posts, not just the inserted post (which may or may … Read more