Best way to add image to recent posts widget?
Best way to add image to recent posts widget?
Best way to add image to recent posts widget?
You’re looking for the get_adjacent_post function. This is a built-in wordpress function that you can use to get either the previous or next post from the current post. To get the next post: $next_post = get_adjacent_post( false, ”, false, ” ); To get the previous post: $prev_post = get_adjacent_post( false, ”, true, ” ); You … Read more
You can achieve this by developing custom code like following. You can find more information about WP_Query here https://codex.wordpress.org/Class_Reference/WP_Query <?php $args = array( ‘posts_per_page’ => 100, ‘meta_key’ => ‘_thumbnail_id’, ‘ignore_sticky_posts’ => 1 ); // The Query $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { … Read more
You can pass arguments to pass meta_query to your wp_get_recent_posts() function. wp_get_recent_posts() makes call for get_posts(), so you can make use of all the arguments get_posts() or WP_Query uses. As per your need. $args= array( ‘meta_query’ => array(array(‘key’ => ‘_thumbnail_id’)) ); $recent_posts = wp_get_recent_posts($args); Along with other arguments you want to pass to your function. … Read more
<div class=”page-loop”> <?php while (have_posts()) : the_post(); $page_title = strtolower(get_the_title()); the_title(‘<h1>’,'</h1>’); ?> <p><?php the_content(); ?><p> <?php endwhile;?> </div> <!– Get the most recent post that has been tagged with the page title –> <div class=”related-posts”> <?php $args = array( ‘tag’ => $page_title, ‘posts_per_page’ => 1, ); $query = new WP_Query($args); if ($query->have_posts()) : while ($query->have_posts()) … Read more
Updated answer below <?php define(‘WP_USE_THEMES’, false); require(‘blog/wp-blog-header.php’); ?> <div class=”row row-60 row-sm”> <?php $args = array( ‘numberposts’ => 3, ‘post_status’=>”publish”,’post_type’=>”post”,’orderby’=>”post_date”); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post);?> <div class=”col-sm-6 col-lg-4 wow fadeInLeft”> <!– Post Modern–> <article class=”post post-modern”><a class=”post-modern-figure” href=”https://wordpress.stackexchange.com/questions/316782/<?php the_permalink( $post->ID ); ?>” target=”_top”> <?php echo get_the_post_thumbnail( $post->ID ); ?> … Read more
Posts Per Page with a button to add more Posts
From your static page you can make a jQuery GET request ( using jQuery is not mandatory though can be the easiest way) to the default endpoint posts of the WP rest of your installation. More info about WP REST here: https://developer.wordpress.org/rest-api/ <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js”></script> </head> <body> <ul id=”remoteList”> … Read more
Linking to the most recent post in my podcast category
I got this fixed the proble was in the custom.css where i added .s-right{ margin-top:-30px; } i removed that and that fixed the margin issue