custom post type index page

If you have: register_post_type( ‘my_custom_post_type’, $args ); And you need a custom page to displays all entries from this custom post type, you have to create: archive-my_custom_post_type.php. But if you don’t need a custom page, wordpress will use archive.php to display you custom post type archive. If you only need to customize the entry page, … Read more

How to create an archive for all posts that do not have a post format?

For me I’d used a little different approach: use an endpoint to create an url like http://example.com/no-formats/ hooking pre_get_posts to set the proper query if needed filter template_include to force WP to use home.php instead of duplicating it No more. add_action(‘init’, ‘add_no_format_endpoint’); function add_no_format_endpoint() { add_rewrite_endpoint( ‘no-formats’, EP_ROOT ); } add_action(‘pre_get_posts’, ‘handle_no_format’); function handle_no_format( $q … Read more

Set homepage to only display posts from one tag

You should use pre_get_posts to alter the main query on the home page. With the proper conditional tags and parameters (check WP_Query for available parameters) you can achieve what you need You can do the following to just display posts from a given tag on your homepage add_action( ‘pre_get_posts’, function ( $query ) { if … Read more

On Install, which code sets the ‘home’ option?

When the installer runs it calls wp_install(), that in turn calls populate_options() defined in wp-admin/includes/schema.php, which runs the following.. if ( !__get_option(‘home’) ) update_option(‘home’, $guessurl); Prior to that $guessurl is defined by.. $guessurl = wp_guess_url(); The guess URL function is defined in wp-includes/functions.php and looks like this. function wp_guess_url() { if ( defined(‘WP_SITEURL’) && ” … Read more

Linking to page with all posts

You have to create a page template with Loop inside. Then create a page “All My Posts” and assign the template you’ve created to it in “Page Attributes” section of “Edit Page” admin page. You can link to this page from the Front Page using get_page function. Function Reference/get page.

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