Meta_Query as a way how to setup CPT permalinks – is it a good thing?

Since it is a performance question, you might be able to avoid using meta keys at all by storing/getting that data another way and not having to set a separate meta field to match with… a. You could get the year from the published $post->post_date… So that when doing the query just use the date … Read more

has_archive=false on the default post type

Late answer. has_archive applies only for the rewrite arguments. In Detail If has_archive is set to true, then the $archive_slug will get set to the rewrite[‘slug’] argument. If then a rewrite[‘with_front’] arg is set, then this one will get prepended. The result of this will then get added as rewrite rule: add_rewrite_rule( “{$archive_slug}/?$”, “index.php?post_type=$post_type”, ‘top’ … Read more

Displaying category archive of custom post types

You can force use of your template for categories with the category_template filter: function wpa57439_category_template( $templates=”” ){ if( !is_array( $templates ) && !empty( $templates ) ) { $templates = locate_template( array( ‘archive-actors.php’, $templates ), false ); } elseif( empty( $templates ) ) { $templates = locate_template( ‘archive-actors.php’, false ); } else { $new_template = locate_template( … Read more

Add custom field to the archive page?

Using the Advanced Custom Fields plugin you can assign options pages to you custom posttype like this: if( function_exists(‘acf_add_options_page’) ) { acf_add_options_page(array( ‘page_title’ => ‘YOUR_PAGE_TILE Options’, ‘menu_title’ => ‘YOUR_MENU_TITLE Options’, ‘menu_slug’ => ‘options_YOUR_SLUG’, ‘capability’ => ‘edit_posts’, ‘parent_slug’ => ‘edit.php?post_type=YOUR_CUSTOM_POSTTYPE_SLUG’, ‘position’ => false, ‘icon_url’ => ‘dashicons-images-alt2’, ‘redirect’ => false, )); } That way you get an … Read more

How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling

First, for layout and CSS styling, I would recommend creating template files for the contexts you want to customize; i.e. create a category.php and a tag.php for the category and tag index archive pages, respectively. In either case, copy archive.php (or, if it doesn’t exist, copy index.php), and rename the copy as category.php. Then, modify … Read more

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