Custom Loop with certain number of one category
If you only want posts from the category with ID 2, that’s easy, only ask for category 2: ‘cat’ => array( 2 ),
If you only want posts from the category with ID 2, that’s easy, only ask for category 2: ‘cat’ => array( 2 ),
Ok…So, I was able to find an example that helped: function faq() { $output=””; $query = new WP_Query( ‘post_type=faqs’ ); if ( $query -> have_posts() ) : while ( $query -> have_posts() ) : $query -> the_post(); $output .= ‘<h3>’.get_the_title().'</h3>’; $output .= ‘<p>’.get_the_content().'</p>’; endwhile; endif; wp_reset_postdata(); return $output; } add_shortcode( ‘faqs’, ‘faq’ ); This puts … Read more
Check if current post in loop is last on current page
Not sure if this’ll work for you because I don’t know if $attachment_ID in the function is returning anything at all… …but assuming it is: function custom_pic_alt( $attachment_ID ) { //var_dump( $attachment_ID ); //uncomment this and see if it even returns anything. $thumb_alt = get_post_meta( $attachment_ID, ‘_wp_attachment_image_alt’, true ); $thumb_caption = wp_get_attachment_caption( $attachment_ID ); $thumb_title … Read more
Get title of page containing post grid within the posts
Duplice post with standard WP loop – fixed by using query_posts() instead
You shouldn’t be using new WP_Query() in archive-product.php (or any archive template). The right posts have already been queried, and this is what the pagination is based on. You just need to loop through the right posts with the standard loop. Look at the default archive template in WooCommerce: while ( have_posts() ) { the_post(); … Read more
Seems like one of your ACF fields contain a <a> tag in them. In HTML you cannot have and <a> tag inside another <a> tag. Check the ACF fields the_field(‘feature_item_title’) and the_field(‘hero_subtitle’), check their content, most likely you will find a <a> tag in one of them, remove it and your html will be structured … Read more
then check like that: $thumb_id = get_woocommerce_term_meta( $subcategory->term_id, ‘thumbnail_id’, true ); $term_img = wp_get_attachment_url( $thumb_id ); and check like this $meta = get_term_meta( $subcategory->term_id ); var_dump($meta); $thumb_id = $meta[‘thumbnail_id’][0]; $term_img = wp_get_attachment_url( $thumb_id ); and you also get like this $thumbnail_id = get_term_meta( $subcategory->term_id, ‘thumbnail_id’, true ); $image = wp_get_attachment_url( $thumbnail_id );
On :hover you should change the svg-image, not the color. The second image is a copy with a different color. For example, if your image is shown in the background, you can change the style in this way: .sidebar-btn-icon:hover { background-image: url(button_image_red.svg’); }