wordpress blog posts’s time

In your template where you see the_title(), you will want to change it to something along the following: echo get_the_title() . ‘, ‘ . ‘posted by ‘ . get_the_author() . ‘, ‘ . human_time_diff( get_the_time( ‘U’ ), current_time( ‘timestamp’ ) ) . ‘ ago’; human_time_diff() is the one doing the part regarding your topic. Though … Read more

Adding code to head to all pages manually

You might use the wp_head action, That is triggered within the section of the user’s template by the wp_head() function. add_action(“wp_head”, “hook_js”); function hook_js() { if(is_home() || is_front_page(){ $output=”<script> alert(‘Page is loading…’); </script>”; echo $output; } } Note that is better to add style and script with the action wp_enqueue_scripts and then enqueue and register … Read more

Building articles grid

Use WP_Query for getting the posts you want. Then you can loop through them and get their title, their featured image and their excerpt to be printed they way you want. Something like that: <?php $args = [ ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 9, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ]; ?> … Read more

How to create first post, fifth post full width, rest in three columns and so on

<?php get_header() ?> <div class=”container-fluid”> <div class=”row”> <?php $i = 0; while ( have_posts() ) : the_post(); ?> <?php if ($i == 0 || $i % 4 == 0) : ?> <div class=”col-sm-12 blog”> <div class=”row”> <div class=”col-sm-8 p-0″> <?php the_post_thumbnail()?> </div> <div class=”col-sm-4 align-self-center”> <div><h3><?php the_title()?></h3></div> <div><?php the_excerpt()?></div> </div> </div> </div> <?php else: ?> … Read more

WordPress Blog – Grid View

I use the masonry way at the end of my css; /* Masonry Custom CSS for the Grid Style Blog */ /* Masonry container */ body.blog div#content, body.archive div#content { -moz-column-count: 3; -webkit-column-count: 3; column-count: 3; -moz-column-gap: 1em; -webkit-column-gap: 1em; column-gap: 1em; max-width: 100%; margin-left: 20px; margin-right: 20px; } /* Masonry bricks or child elements … Read more

Problem with Comment link in Blog [closed]

I’m not sure, if you’re talking about the comment reply or a normal (non-reply) comment. Anyway, here’s how you’d register the comment reply script from your functions.php file: function wpse60406_scripts() { # Comment reply script if ( is_singular() // Use is_single() if this shouldn’t work for pages AND get_option( ‘thread_comments’ ) ) wp_enqueue_script( ‘comment-reply’ ); … Read more

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