Custom post type archive page template

I have managed to resolve this by adding in a custom rewrite into the functions file: // Add custom rewrite rules to handle things like years in custom post archives function add_rewrite_rules($aRules) { $aNewRules = array( ‘news/([0-9]{4})/([0-9]{2})/page/?([0-9]{1,})/?$’ => ‘index.php?post_type=clientnews&year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]’, ‘news/([0-9]{4})/([0-9]{2})/?$’ => ‘index.php?post_type=clientnews&year=$matches[1]&monthnum=$matches[2]’, ‘about-us/other-news/([0-9]{4})/([0-9]{2})/page/?([0-9]{1,})/?$’ => ‘index.php?post_type=othernews&year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]’, ‘about-us/other-news/([0-9]{4})/([0-9]{2})/?$’ => ‘index.php?post_type=othernews&year=$matches[1]&monthnum=$matches[2]’ ); $aRules = $aNewRules + $aRules; return … Read more

wp_query check if integer exists in custom field’s array

First of all, your meta_query is wrong. It should be an array of an array, not just an array So, the following ‘meta_query’ => array ( ‘key’ => ‘qd_resource_author_selector’, ‘value’ => $myAuthor, ), becomes ‘meta_query’ => array ( array( ‘key’ => ‘qd_resource_author_selector’, ‘value’ => $myAuthor, ), ), Secondly, you can optimize your query. You are … Read more

Admin search ACF relationship

Here is a code snippet that will do what you described: add_action( ‘pre_get_posts’, ‘wpsx_185734_acf_search_relationship’ ); function wpsx_185734_acf_search_relationship( $q ) { $screen = get_current_screen(); $s = $q->get(‘s’); $post_type = $q->get(‘post_type’); // Be very selective when running code at the pre_get_posts hook if ( ! is_admin() || empty( $s ) || ( isset( $screen->post_type ) && ‘story’ … Read more

Replace text in post from cvs

Best thing to do is to write your own CSV import php file. By using functions like wp_insert_post() you can insert the data from the csv file as a new post in the wordpress database. If you’re not a coder, which I’m sensing, you can try this plugin: https://wordpress.org/plugins/wp-ultimate-csv-importer/. The free function offers everything you’re … Read more