Use category base slug in posts’ permalink

I may be missing some vital detail in the question but here’s what I did to make this work. Settings -> Permalinks Set the permalinks to… /somePrefix/%category%/%postname%/ This will give you the following permalinks… Blog Page – domain.com/somePrefix Category Page – domain.com/somePrefix/currCategory/ Single Page – domain.com/somePrefix/currCategory/singlePost/ If you install some kind of plugin like Yoast … Read more

How can I make it so the Add New Post page has Visibility set to Private by default?

since you’re developing a plug-in, I assume you don’t want to touch any files outside of wp-content/plugins or ../themes for that matter. However, if that’s not the case, follow along: Go to wp-admin/includes/meta-boxes.php and find: $visibility = ‘public’; $visibility_trans = __(‘Public’); Now change it to the obvious: $visibility = ‘private’; $visibility_trans = __(‘Private’); Again, this … Read more

How To Have Two Gutenberg Editors On One Post?

You could add some kind of separator (a separator block?) in Gutenberg, then filter the_content() to check for the separator to display each half, by setting a switch on the first half and detecting it for the second: add_filter(‘the_content’, ‘content_splitter’); function content_splitter($content) { $separator = “<!– wp:core/separator”; $pos = strpos($content, $separator); if ($pos !== false) … Read more

Linking Two Post Types

Scribu’s posts-to-posts is a great and simple plugin, I’m sure we can help you get it working. The basic usage is pretty straightforward. assuming your custom post types are named ‘place’ and ‘event’, the following code would go into your theme’s functions.php file: function my_connection_types() { p2p_register_connection_type( array( ‘name’ => ‘events_to_places’, ‘from’ => ‘event’, ‘to’ … Read more

Including categories in search results

I’m using this code in my search.php above the main loop: $search_term = explode( ‘ ‘, get_search_query( false ) ); global $wpdb; $select = ” SELECT DISTINCT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN (‘category’)”; $first = true; foreach ( $search_term as $s ){ … Read more

How to Check if a Page Exists by URL?

You could make a list of paths to check… $page_paths = array( ‘analysis/firstNamelastName’, ‘exercise/firstNamelastName’ ); Then check if there’s a page object for each of the page paths. foreach( $page_paths as $page_path ) { echo ‘<code>’ . $page_path . ‘</code> ‘ . PHP_EOL; if( ! $page = get_page_by_path( $page_path ) ){ echo ‘Does not exist.’ … Read more

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