Posts from a category on homepage with category archieves page default css

$args = array( ‘posts_per_page’ => 5, ‘cat’ => 77 // 77 – id category ); $query = new WP_Query( $args ); // loop if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); echo ‘<li>’; the_post_thumbnail(); echo ‘<a href=”‘.get_permalink().'”>’ . get_the_title() . ‘</a></li>’; } } else { // posts not fount echo ‘posts not … Read more

Make Home page current if there are sub-menus

Typical menu structure with ‘Home’ item being a Custom Link and other menu items being pages: The ‘Home’ menu item must not point to a real page and should look like that: The ‘Home’ menu item stays the same, regardless of the choice you’ve made in Settings -> Reading -> Front page displays. Remove the … Read more

Working with WordPress theme

First check in your WordPress backend like 1) For Post: xyz.com.wp-admin/post-new.php post where if there is an option to select the template. If this option available then select the “Full Width Template” 2) For Page: xyz.com.wp-admin/wp-admin/post-new.php?post_type=page page where if there is an option to select the template. If this option available then select the “Full … Read more

I want to load a pre-built php page (and assocated scripts/styles/directories) as the front page. How do I go about this?

As shown in the template hierarchy image from the documentation, you can name your .php file as front-page.phpor home.php. By default, WordPress sets your site’s home page to display your latest blog posts. This page is called the blog posts index. You can also set your blog posts to display on a separate static page. … Read more

How can I load 2 random pages?

You can redirect users from home page to random page with this code (paste it to your functions.php) function my_homepage_redirect() { if ( is_home() || is_front_page() ){ $page = get_posts( [ ‘post_type’ => ‘post’, ‘posts_per_page’ => 1, ‘category’ => 1, // your category ID ‘orderby’ => ‘rand’, ‘fields’ => ‘ids’ ] ); if ( empty( … Read more

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