Is there any possibility to get featured post title and image using the JSON API. I tried using this: example.com/?json=the_post_thumbnails&count=3 But instead of recent posts, I get featured posts.
It looks like I will need to create custom PHP code for this and either add it to my includes directory within a custom PHP file, or to the functions.php file. I need the ability to use a featured image in a post and be able to also dynamically display that same image in a gallery on the frontpage. I am not a PHP master by any means, but I know a bit to get around. My guess is I …
My current WP configuration Theme used : DIVI Extensions in place : Almost none Name of the host : Infomaniak Site address : not yet created Problem(s) encountered : Hello, First of all, thank you to all those who will take the time to read this post and to give me their help. I'm currently starting a website that I'm very interested in and there is one feature in particular that I don't really know how to implement. I will …
I wish to have a different section for a certain category of posts displayed in the landing page of my WordPress website, while posts of various other categories display in an other section. Is this possible in WordPress?
My loop displays featured posts and then posts in reverse chronological order. However when I use <?php echo get_previous_post(); ?> it grabs posts in reverse chronological order. How do I add a filter to the previous post function similiar to this but instead filter by an array like this: 'orderby' => array( 'meta_value' => 'DESC', 'date' => 'DESC') ? Code: UPDATE: Cleaned up index.php loop after help from @sMyles and @JackJohansson Index.php loop: $args = array( 'posts_per_page' => - 1, …
How to show featured image (medium sized) relative URL (relative to the website root)? I need something like this: uploads/214/07/image-600x400.png I tried with this: if ( has_post_thumbnail()) { $medium_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium'); echo $medium_image_url[0]; } It works fine, I get path of medium sized featured image, but with domain name too, and I need it without domain name. Also I tried like this: global $wpdb; $the_thumbnail_id = get_post_thumbnail_id($post->ID); $the_thumbnail_name = $wpdb->get_var( "SELECT meta_value FROM $wpdb->postmeta WHERE post_id = '$the_thumbnail_id' …
I have a lot of posts on my news site, I have a problem with space, I would like for posts older than three months, to delete the images that are in the post, but to keep the featured images and the post itself. Please help, I have no idea how to do this.
I would like to display 6 featured products from my woocommerce store on my home-page.php template. After some researched I found that the right way to do this was through a custom loop,( I do not wish to use shortcodes because I would like to add additional classes for styling etc. ) I also found that the key that woocommerce uses for the featured products is '_featured'. I put together the code below to display any products that I chose …
I'm learning Wordpress development on Udemy and currently developing a theme. I haven't added any custom taxonomy but just using the "Post" and "Categories". Found a tutorial of how to add "Featured Posts" I have created 3 categories, and I want to display featured post of that category when loads the category.php and avoid duplicated post. The issue now is that the featured post (Ex. Category 1) is displaying on all category pages. Here is my code: <?php $args = …
How do I get the id of the most recent wordpress audio media upload. The reason for this is that I want to use audio cover images/ featured images as a post featured image. Do I need to retrieve the ID of the thumbnail in the audio. I tried the code below but it returned error $attachments = get_posts( array( 'post_type' => 'attachment', 'posts_per_page' => 1, 'post_status' => null, 'post_mime_type' => 'audio' ) ); foreach ( $attachments as $attachment ) …
I have set up a custom loop to display featured products at the top of their relevant category pages. but now I would like to go about removing featured products from the regular loop below, which is using the standard woocommerce code to display products, Any help would be greatly appreciated http://onthesquareauctions.com/index.php/product-category/emporium/furniture/chairs-emporium/
I have decided to separate my main website and my blog with different Wordpress installs. I've installed my blog in the subdirectory (/blog/ folder) and my main Wordpress is only contained homepage and pages related to my business. The problem is, is it possible to create a section on my main website that lists 4 latest posts from my blog that are installed in the subdirectory? I have searched all over the internet for the solution, but I've found nothing. …
Am working on a blog page and I want to have a featured post as a banner. I have no idea how can I make only one post can be marked as the "Featured" so if another post is marked as "Featured" it removes the old post from showing as featured. I've tried using ACF (Advance Custom Field) checkbox to mark featured posts but my approach is incorrect. Here is my code. <?php global $post; $myposts = get_posts( array( 'posts_per_page' …
I have created a feature post check box on the post page. Now what I am doing is if any user-selected that checkbox then I have to show that post on the category page. I tried below code but it's not displaying. Code is to add feature post on post // add feature post on post page function register_post_assets(){ add_meta_box('featured-post', __('Featured Post'), 'add_featured_meta_box', 'post', 'advanced', 'high'); } add_action('admin_init', 'register_post_assets', 1); function add_featured_meta_box($post){ $featured = get_post_meta($post->ID, '_featured-post', true); echo "<label for='_featured-post'>".__('Feature …
Took over a project, and one of the errors is the featured images (and certain others rendered in a similar way) are duplicating themselves and replacing the next image thumbnail. <a href="<?php echo get_permalink(); ?>" class="snack__thumb snack__thumb--featured" style="background-image:url('<?php echo get_the_post_thumbnail_url( $post->ID, 'medium' ); ?>');"> <?php if (has_category('whitepaper')) { ?> <div class="snack__banner"><span>whitepaper</span></div> <?php } ?> I've read that not ending a loop with something like wp_reset_postdata(); can cause this type of error however I haven't been able to get it solved. …
My feature images keeping showing up too large, I have tried to resize the images and re-upload but they are still showing up too big. I have tried to put in CSS code and gone onto Media setttings but haven't had much luck yet. Can anyone help please?
How can I show a post featured image by post id in gutenberg editor? I have a slider with latest posts and when I iterate through over posts I would like to show the post featured image as well. Here is my example snippet const cards = displayPosts.map( ( post, i ) => { console.log(post.featured_media) return(<div className="card" key={i}> <div className="card-image"> <div className="image is-4by3"> <PostFeaturedImage currentPostId = {post.id} featuredImageId = {post.featured_media} /> <div className="news__post-title"> <div className="title is-5"> <a href={ post.link } …
In twenty fourteen theme, we’d like to know how to change the features content tag. Currently it’s set as featured. Now, we would like to know how to code this for different page templates. We notice in page.php there is a piece of code calling the template part featured-content. <?php if ( is_front_page() && twentyfourteen_has_featured_posts() ) { // Include the featured content template. get_template_part( 'featured-content' ); } ?> From our understanding this calls the file featured-content.php. In this file, is …