All Questions
Tagged with loop customization
121 questions
0
votes
2
answers
717
views
fetch from an external api call and display results in page
I have placed my external api call inside the functions.php file in the server and I created a shortcode for the api call.
I'm familiar with React and I was expecting Wordpress to be somewhat similar.
...
0
votes
0
answers
37
views
Advanced Custom Fields in WP_Query: Href Returning Empty
I'm still learning the ropes of PHP so please bear with me!
So basically I have an ACF URL field "author_link" that I want to generate on a "table of contents" page in a list ...
1
vote
0
answers
11
views
Add More Featured Data Not Sending to Database
I have made one form which is two step based. also i have added feature add more. So when you add click show same filed duplicate on step two.
Problem----
When i'm trying to send data by (add more) ...
0
votes
1
answer
39
views
wordpress custom fields loop
I need to do wordpress custom fields loop: here is the code to describe better:
<?php
$term = get_term_by('slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$query = new WP_Query(...
1
vote
0
answers
65
views
CPT Loop with ACF and passing ID between Loops
I have a staging site at:
https://tozsdeforum.ethermedia.hu/
Near the top of the page, we have a "Kiemelt Hirek" section.
In this section, there are five loops in play:
IF (pos1 == true) {...
0
votes
0
answers
49
views
delete an array element when its date expires
I have user levels for access content. I made a start date and end date input for each other. Each level has its own history. Whichever level date exceeds today's date, it will be removed from user ...
0
votes
1
answer
1k
views
update_user_meta as multiple value but with same meta key
I have this code. When I save it, the user levels adding and gives time select input next to it. But when I give different time to levels, for example: Level 1: 2 weeks, Level 2: 9 Months
If saves ...
0
votes
0
answers
374
views
Wordpress next post by ajax call on button click
I have an archive of custom post type "Trivia" where I want to display next custom posts on click of a button "Next Post"
I have this code for displaying 1 post on archive page:
$...
2
votes
1
answer
276
views
How do you output custom code between posts in the loop?
I am trying to put a header before past posts and after future posts.
I'm using get_posts() in a function to output the posts using a foreach loop for a custom post type ordered by date (meta key). If ...
0
votes
1
answer
557
views
How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
PHP and Html Code
<?php
//get your custom posts ids as an array
$...
0
votes
0
answers
19
views
How to show related post with category DESC (ASC) IDs of ID current post
I have example Post 1(id-1), 2(id-2), 3(id-3), 4(id-4), 5(id-5), 6(id-6), 7(id-7), 8(id-8) ,9(id-9)... with same catergory.
When in post 9, i need show related post 8, 7, 6
When in post 8, i need ...
0
votes
1
answer
9k
views
Adding new divs with custom classes to products on WooCommerce shop page [closed]
In a custom Wordpress theme I need to display product image and product summary side by side on the WooCommerce shop page, so I am trying to add new divs with custom Bootstrap classes;
I used ...
0
votes
1
answer
4k
views
Loop in elementor custom widget not working
I have a custom made widget for elementor, but my problem is that my loop to get posts doesn't work properly. Currently, it returns the title of the page where the widget was inserted, doesn't show ...
0
votes
1
answer
41
views
Avoid showing the same phrase in the loops
I use this multiple loops to show the sold of some wears, so if there are the sold (meta_value=yes) the txt or presentation must be showing one time in top, and others products in bottom, and if the (...
0
votes
1
answer
159
views
Multiple loops on same category with different design
I am having a problem regarding the showing the multiple loops on the category posts
i want a posts from a category=social where 3 design is located
the structure is as follows
Note: I want a ...
0
votes
1
answer
234
views
Custom query pagination with php parameter as arg problem
I have create a loop with a custom query. This query contains a php parameters that i m getting from url with GET method. The problem is that the pagination (even if it counts the posts correct at ...
2
votes
2
answers
2k
views
Show post page only if the user has bought a specific product
I'm having troubles with Woocommerce.
I need to sell videos.
I've created virtual products with a link to a different post for each (no download as I prefer to embed the video on my website and to use ...
0
votes
0
answers
38
views
My post loop needs to have 8 different post templates
Firstly let me just say I am a beginner with backend but have learned a lot the past few weeks working on this backend project my company has allowed me to work on. I've learned to use Ajax, create ...
2
votes
1
answer
208
views
Last post is not showing up
I'm developing a custom template for a customer that wants in his website the possibility to filter posts by month.
After creating an archive.php page and placing the widget "Archives" in my sidebar I ...
1
vote
1
answer
118
views
Loop through custom fields with similar label / common chars in label
I created several custom fields for my custom post type "books"
There is a checkbox for languages. Whenever a language gets checked, several custom fields for that language get added (i.e. title, ...
0
votes
1
answer
156
views
CPT: multiple loops with different terms
I didn't finde the right code for 3 days... now i'm asking you:
I want to achieve the following:
Here my post query:
$posts = new WP_Query(array(
'post_type' => 'tarife',
'posts_per_page'...
9
votes
1
answer
58k
views
how to override woocommerce specific loop or archive-product.php [closed]
so far while my woocommerce theme loop through all products in shop page i'm trying to customise and add few bootstrap classes to style it in a prober way since default styles generated causes layout ...
0
votes
0
answers
243
views
Remove Custom metabox from particular page template is used
I have created custom metafields like the following and it was working fine. I want to show the metafield only when an particular page template is used. but it was not working.
class ...
2
votes
1
answer
142
views
get_option issues
Hello the first thing I'm sorry for my poor english level.
I was looking some tutorial to use the customizer on wordpress for a theme from scratch. But I have some issues with get_option, I have no ...
1
vote
1
answer
3k
views
How can I display a PHP foreach loop's answers by AJAX
I have a problem in my AJAX request, I'm trying to get values from a foreach cycle, but it returns empty
Functions.php file
function selectEstado(){
global $wpdb;
if(isset($_POST["selectVal"])){
...
0
votes
1
answer
297
views
Multisite - Getting Meta query to select from wp_2 tables
Quite new to Wordpress, so if you'll bear with me :-)
I was asked to create a feature which lists 4 featured products on the front page. Now the one requirement was that the feature was to only ...
0
votes
1
answer
146
views
How to append the excerpt to the content in the single post page?
For every Post, I have content and excerpt. I am trying to figure out how to include both of these in the single post page.
So far this is what I have:
function after_post_content($content){
if (...
0
votes
2
answers
1k
views
Querying another post category to match current post and display in loop
I'm trying to query a custom post type's category to display in another custom post type, but only if they have matching categories.
I'm new to coding a fairly complex WordPress site from scratch (it'...
0
votes
2
answers
509
views
get_delete_post_link() inside Loop stubbornly returns nothing
I've built a membership site where users can post listings from the frontend, edit those, and ideally also delete them.
For the latter, I'd like to echo a "delete post" link to the frontend. The ...
0
votes
1
answer
1k
views
Custom Post type content within a slider
I'm trying to create a slider that displays slides with info from custom post type posts (Testimonials). I have a page template set up that generates divs with the post content, but what's the best ...
0
votes
1
answer
39k
views
I'm trying to create an array with a foreach loop, but the array only stores the last item [closed]
My code is:
<?php
//Get posts by the arguments saved in the $args array
$vendor_postlist = get_posts( $args );
// Loop the list of posts obtained and for each post extract its product category ...
0
votes
0
answers
4k
views
Multiple Owl Carousels on the same page with navigation problem
The index page of my Wordpress includes a loop dividing my posts per months. To display each month I'm using Owl Carousel 2. I'm experiencing some difficulties with the navigation of each carousel/...
0
votes
1
answer
56
views
Custom post type - Loop out in random order but same 15 to appear first... still random
O.K. slightly strange request but I want to loop out my Custom Post type in a random order... BUT have my 'Favourite' posts stay above the rest. I would guess this is what 'Sticky' posts were meant ...
0
votes
1
answer
33
views
Pull A Single Post Prior To Running wp_query
I have a functioning wp_query loop that is pulling all of the employees for a company from a custom post type. I figured out how to display the employees in alphabetical order by last name. I now need ...
0
votes
1
answer
74
views
Place content inside the Post Loop
Has anyone had any luck manipulating the Post Loop to insert content between post data? I'm looking to post content in between my posts as they are displayed on the archive, and homepage templates.
...
0
votes
2
answers
2k
views
Remove any product that is featured from regular display loop [WooCommerce]
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 ...
0
votes
1
answer
53
views
Two Sections on Woocommerce Catergory Page [closed]
I would like to be able to customise the layout of the category pages of my website.
If possible, I would like to make it so that products will appear in two sections, determined by a custom ...
-1
votes
1
answer
700
views
Loop display only 5 posts
I`ve more than 5 posts with type job, but my script show only 5, and I know what is wrong.
get_header ();
$args = array (
'post_type' => 'job'
);
$myposts = get_posts ( $args );
if (! ...
0
votes
1
answer
35
views
Wordpress query posts by custom post type not workng
I'm trying to display the featured images of my custom post type of 'instrument'
I created the custom post type using the plugin 'Custom Post Type UI'
The query seems to work, but the problem is ...
0
votes
1
answer
64
views
How to keep a CPT stick to specific position?
I have created a CPT (esp-publicitarios) using Metabox plugin with the following code:
add_filter('rwmb_meta_boxes', 'elclarin_register_meta_boxes');
function elclarin_register_meta_boxes($...
0
votes
1
answer
30
views
Highlight specific user with custom field value
I'm working on a Wordpress project with some friends from school. But there's a problem with highlighting a user on the website. The idea is to create a 'User of the month' thing.
In the user ...
0
votes
2
answers
1k
views
Pagination Not working on Home Page with 2 Query
I have two loops in home page (index.php)
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 3,
);
$another_query = new WP_Query($args);
if( $...
0
votes
1
answer
59
views
Show Posts By Custom Field
I’d like to add 2 custom fields to my posts:
show_post_on_home_page
home_page_posts_order_sequence
I then want my home page to show only the posts where show_on_home_page == true, ordered by ...
2
votes
1
answer
777
views
Creating loop within functions.php
I'm using Woocommerce on my website, on the checkout page I've got a custom select checkout field with radio buttons. I'm using this working snippet within my functions.php:
/**
* Add the field to ...
1
vote
1
answer
1k
views
Displaying recent post excerpts on static front page
I'm trying to display a static front page with recent posts at the bottom. Specifically, I want to display just an excerpt from the recent posts, as would be returned by the_content() if I had a ...
0
votes
4
answers
73
views
custom loop issue
I am trying to get a custom loop to work and I can not see why it is failing.
$args = array( 'category_name' => 'audio', 'posts_per_page' => 6 );
$sound = new WP_Query( $args );
...
-2
votes
2
answers
284
views
Woocommerce linking variations
So I have this array (just taking an example, it's dynamically built up):
$v_values = array(
array("C1","C2"),
array("F1","F2")
);
$v_name = array("color","...
1
vote
1
answer
111
views
Changing layout with wp_customise
So I'm trying to build a conditional statement to display different layouts depending on the option selected.
Having a bit of trouble.
$wp_customize->add_setting('layout', array(
'default' ...
0
votes
1
answer
164
views
toggle Multiple Loop with tittle
I need some help
I want to list all post from a meta_key, order by meta_value in ASC order
All this in 1 toogle jquery.
I've this:
<div id="box-temp" class="gray-shadow">
<!-- First Loop --...
0
votes
1
answer
83
views
Secondary loop doesn't work
Hi I got a problem with my secondary loop in my template page.php.
I'm trying to display some testimonials, the code that retrieve those testimonials works perfectly fine in my index.php but I won't ...