Can’t split the_title() by white space

The first way you tried should work if you use get_the_title() instead. It’s because get_the_title returns the title, whereas the_title() function echos the title by default. $title_split = explode(” “, trim(get_the_title()));

Why is a wp function used in current PHP namespace’s callback not resolved to global scope?

From your comment: Apparently the function can indeed not be used on the frontend in wp (see here), can anyone confirm this? I can confirm that the post_exists() function can be used on the front-end, but you need to manually load the file that defines the function, which is wp-admin/includes/post.php — see the “File: <path>” … Read more

Create a custom posts page

When you select a page as your blog page, the template that WordPress is looking for is the home.php file. You should really check out the Template Hierarchy from the WordPress documentation as these things are really WordPress basic knowledge. Check out the Template Hierarchy here: https://developer.wordpress.org/themes/basics/template-hierarchy/

How to set a template with wp_insert_post

You can check this code I am able to work with this function cutom_function() { $new_page_id = wp_insert_post( array( ‘post_title’ => ‘PKB’, ‘post_type’ => ‘page’, ‘post_name’ => ‘pkb’, ‘comment_status’ => ‘closed’, ‘ping_status’ => ‘closed’, ‘post_content’ => ”, ‘post_status’ => ‘publish’, ‘post_author’ => get_user_by( ‘id’, 1 )->user_id, ‘menu_order’ => 0, // Assign page template ‘page_template’ => … Read more

When are Shortcode Attributes Available in Template

I need access to the shortcode attributes before the content (and it’s shortcode) is processed…. in the first “is $atts available here” after the add_shortcode In that case, you can manually parse the shortcode and retrieve its attributes (if any) like so, which uses get_shortcode_regex() and shortcode_parse_atts(): $content=”before blah2 [foo bar=”baz” num=”123″] after”; preg_match( “https://wordpress.stackexchange.com/” … Read more

Automatically going to the first page in a hierarchy?

Referencing the wp_list_pages function reference You’ll probably need to use the second structure you listed, with one change: -Cars (shows a submenu with a list of cars, ie Volvo 850, Porsche 911 ) -Volvo 850 overview (the page you get when you click Volvo 850 on the Car page) -Volvo 850 tech spec (the three … Read more

Which file/template is in charge of taxonomies for custom post types?

There’s a giant diagram on the wordpress documentation showing how it chooses which file to display/load, as you can see here: http://codex.wordpress.org/images/1/18/Template_Hierarchy.png If this doesn’t help, my other suggestion is trying with the ‘_’ removed from the taxonomy name, and to test with the rewrite option removed from your custom post type declaration. In my … Read more