Creating a Page of Posts

Try this code in your page-blog.php to display list of posts $paged = get_query_var(‘paged’) ? get_query_var(‘paged’) : 1; $args = array( ‘post_type’ => ‘post’, //Change this with your post type ‘posts_per_page’ => 10, //No. of Pages to show ‘offset’ => 0, //excluding the latest post if any ‘paged’ => $paged //For Pagination ); $loop = … Read more

shortcode javascript not working on custom template file inside theme folder

You haven’t included get_header() or get_footer() in your template. They will load header.php and footer.php which should include wp_head() and wp_footer(). Those last two functions are important because that’s where scripts are loaded. If your shortcode depends on a script being loaded in the header or the footer, then you need wp_head() or wp_footer(), thats … Read more

Problem after renaming wordpress template file

If you have WP-CLI installed, try to run wp cache flush or you can put this code into your functions.php function fix_template_caching( WP_Screen $current_screen ) { if ( ! in_array( $current_screen->base, array( ‘post’, ‘edit’, ‘theme-editor’ ), true ) ) { return; } $theme = wp_get_theme(); if ( ! $theme ) { return; } $cache_hash = … Read more

Can I show all the template files that are being used on my site?

this would add a column with the page template file name into the ‘Pages’ in the dashboard: // ONLY WORDPRESS DEFAULT PAGES add_filter(‘manage_page_posts_columns’, ‘custom_admin_columns_head’, 10); add_action(‘manage_page_posts_custom_column’, ‘custom_admin_columns_content’, 10, 2); // ADD NEW COLUMN function custom_admin_columns_head($defaults) { $defaults[‘page_template_file’] = ‘Page Template File’; return $defaults; } // SHOW THE PAGE TEMPLATE FILE NAME function custom_admin_columns_content($column_name, $post_ID) { … Read more

Custom Template 404 for specific custom post type

This is going to track only post_type query var, but you also can add checks for query_vars of all your post_types or only ones you would like to get a custom 404 page for. add_filter( ‘404_template_hierarchy’, function( $templates ) { global $wp_query; if ( ” !== $wp_query->get(‘post_type’) ) { array_unshift( $templates, sprintf( ‘%s-404.php’, $wp_query->get(‘post_type’) ) … Read more

Disable front-page.php template

Maybe template_include filter would get the job done for you. Something along these lines, function prefix_another_front_page_template( $template ) { if ( is_front_page() ) { $another_front_page_template=”something.php”; // adjust as needed $new_template = locate_template( array( $another_front_page_template ) ); if ( !empty( $new_template ) ) { return $new_template; } } return $template; } add_filter( ‘template_include’, ‘prefix_another_front_page_template’, 99 );

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