All Questions
3,325 questions
0
votes
0
answers
27
views
How can I order all subcategories alphabetical independent of the parent categories?
These are my hierarchical three level categories:
- Top-Level Cat 1
- Sub1A
- Subchild1A1
- Subchild1A2
- Sub1B
- Subchild1B1
- Subchild1B2
- Top-Level Cat 2
- Sub2A
- ...
0
votes
1
answer
914
views
Make bootstrap 5.0 carousel dynamic using ACF and CPT UI [closed]
I am trying to make bootstrap 5.0 carousel (with indicators) dynamic using ACF and CPT UI. I realized that I need to display the number in data-bs-slide-to dynamically, as well as other numbers and ...
0
votes
0
answers
66
views
How to get specific (grand parent) category of current post?
I am having a category hierarchy with three levels.
My example:
- Top-Level Cat 1
- Sub1A
- Subchild1A1
- Subchild1A2
- Sub1B
- Subchild1B1
- Subchild1B2
- Top-Level Cat 2
- ...
0
votes
1
answer
430
views
How to add a shortcode function that returns the taxonomy slug of the actual post within the loop
Circumstances: I have a CPT called "designs" and a taxonomy related to it, called "project_category" so that I can assign a category to each design. I'm building the template for ...
0
votes
0
answers
411
views
How to Create Carousel Indicators in PHP Loop using wp_get_attachment_url function?
I am trying to Create Carousel Slider in which Images get from the wp_get_attachment_image_url function and all other alt title and caption data it works correctly.
I am stuck at carousel Indicators I ...
0
votes
1
answer
563
views
Show ACF field with link to ultimate member profile/Wordpress user profile below the post (single post layout)
I'm using Advanced Custom Fields and I'm trying to show a custom field below the single post. I managed to get the code to render below the post, but when I set the field movie_actors and save, the ...
0
votes
0
answers
26
views
How to output the taxonomies that are assigned to each custom post?
I'm trying to loop through all custom posts and output the taxonomies that are assigned to each post. The code below is currently just outputting every taxonomy available to the post, even if it isn't ...
0
votes
0
answers
198
views
Woocommerce / Product Columns on Shop Loop / Responsive
I'm trying to make the following layout
1 Column / Mobile
2 Column / Tab
3 Column / Desktop
I have set up the customizer so that there are two rows, and three columns.
This works on desktop, and I can ...
0
votes
1
answer
220
views
Add function after the_content
I have the following function within a simple plugin:
<?php
/**
* Social buttons
*/
function zss_social_buttons() {
?>
<div class="zss">
<!-- Facebook -->
...
0
votes
1
answer
768
views
Populate select list with meta values from all posts of a Custom Post Type
I've got a CPT of Inventory and I'm trying to show a dropdown of all Mfrs. I've got the form and pre_get_posts function so that when a user selects a Mfr, the page refreshes and shows only the ...
0
votes
1
answer
31
views
Why does my loop breaks the css below?
<?php
/**
* My Orders - Deprecated
*
* @deprecated 2.6.0 this template file is no longer used. My Account ...
0
votes
0
answers
211
views
Prevent Duplicate Post Counted by Query
<?php
while ( have_posts() ) : the_post();
$get_series_id = get_post_meta( get_the_ID(), 'series_seri', true );
if (in_array($get_series_id, $do_not_duplicate)) {
...
0
votes
0
answers
52
views
How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
The Setup
I have divided my blog into 3 categories with their respective slugs. There are 3 pages corresponding to these 3 categories with their respective custom page templates. On each page, I ...
0
votes
1
answer
98
views
Hover a css icon width other color inside wp_get_attachment_image
I'm using ACF and have inside a loop: <?php echo wp_get_attachment_image( $button_image, 'small', 'sidebar-btn-icon', ["class" => "sidebar-btn-icon" , "alt"=> &...
1
vote
1
answer
69
views
Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
I currently have a Portfolio custom page in Wordpress, so far work as i want, but i have one problem. The problem is when i click one of the button slug then the body/output is not work like i want, ...
0
votes
1
answer
70
views
Tags on page (not post) returns nothing - why? Improved clarified question!
Problem: I'm trying to echo tags to list items but only manage to echo the "else statement".
Since this is about tags for pages I have added support for pages to show tags in functions.php:
...
0
votes
2
answers
163
views
Wordpress query undefined offset in loop
I created a query with arguments see blow.
On the page I see an error in a loop
Notice undefined offset 1
Notice undefined offset 2
Notice undefined offset 3 and so on...
$args = array (
'...
1
vote
0
answers
492
views
Limit the number of acf content when displaying in post loop [closed]
I display post images by this way in the loop .
<?php
$images = get_field('POST-IMAGES');
$size = 'medium'; // (thumbnail, medium, large, full or custom size)
if( $images ): ?>
<ul>
...
0
votes
1
answer
428
views
wp_get_attachment_url not fetching URL?
the below code does not seem to return an image url at all, chrome inspector says source is unknown
foreach ($subcategories as $subcategory) {
$link = get_term_link( $subcategory->...
1
vote
1
answer
50
views
Exclude category from
I am trying to exclude a category from <?php the_category(', ') ?> inside my loop. I came across the following code on CSS tricks that says would solve the problem. You add this to the functions:...
0
votes
1
answer
133
views
Duplicated <a> tag in loop
I stuck on this issues, looks simple but can't find resolution to fix it.
I have such loop:
<div class="features-items__wrapper">
<h2><?php echo $currentTitle; ...
0
votes
1
answer
237
views
Pagination not working in custom post type. Help
I am currently working on an eCommerce project where I am coding a non-WooCommerce dependent theme for eCommerce. The current problem with me is, I am coding archive-product.php which is a custom post ...
0
votes
1
answer
912
views
Change date format
I am using wordpress for an integration with an recruitment software. Now i am having an issue with an 'endDate' slug. The date format seems to show up as yyyy-mm-dd. How can i change this format to ...
0
votes
0
answers
83
views
Duplice post with standard WP loop - fixed by using query_posts() instead
I have an index.php file on a website designated as the blog page. I have an archive.php file which handles all the subsequent category pages.
I ran into an issue on the archive page, where for one of ...
1
vote
1
answer
317
views
Use object in template part
I try to use a template part in my loop.
<?php
foreach ($categories as $category) {
get_template_part( 'temp-parts/loop/blcnr_loop');
}
?>
In the template part I call the object
<?php
...
1
vote
1
answer
43
views
Wordpress Loop - Not returning projects in specific category
I am attempting to simply pull in all projects in a specific category (e.g. 'websites' or 'featured').
When using:
$args = array(
'post_type' => 'project',
'category_name' => 'websites',
'...
1
vote
0
answers
870
views
Filter the loop by categories using checkbox form
I feel I'm close in solving this issue but kinda hit a wall.
I have a loop on the examlpe.com/blog site and I'd like to be able to filter it using the category checkboxes.
Here is my loop
<h3 class=...
1
vote
0
answers
80
views
Wordpress Loop - Next 3 Posts
Hoping someone here can lend me some advice or point me in the right direction.
I have a working Wordpress php function where I can get the next 2 posts in the loop of the current post within a post ...
0
votes
1
answer
207
views
Query Nopaging action not having effect
I've got a custom loop function in my child theme, in the templates.php file to loop through specific post types ('listings') and then put it into an array to use into a part of my template.
Here's an ...
1
vote
1
answer
66
views
Missing image in gallery shortcode in custom feed
I have problem with custom gallery shortcode and missing first image in each gallery block. For example: [gallery ids="1,2,3,4,5"] show only 2,3,4,5 pictures.
This custom shortcode is part ...
0
votes
0
answers
109
views
Get title of page containing post grid within the posts
I have a page containing a post grid. Within the text of these posts I want to use a shortcode to display the title of the page containing this grid. So, when my page title is "test" I want ...
1
vote
1
answer
268
views
Display all taxonomy terms, add class if term applies to current post
I have a custom taxonomy for a custom post type. I need all available terms (and their descriptions) to display on a single post from this post type, regardless of if each term is applied to it. ...
0
votes
1
answer
3k
views
"Call to a member function have_posts() on array" error on have_posts();
I'm having the weirdest error.
When trying to display a custom loop, I get the following error:
Fatal error
: Uncaught Error: Call to a member function have_posts() on array in /.../custom-page.php:42 ...
1
vote
0
answers
25
views
Change query based on post type while staying in loop
I have a loop that displays three custom post types.
Thing is, all of these post types use a different logic. 'elemzesek' and 'gyorshirek' use ACF fields which you can see in the meta_query.
However, ...
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) {...
1
vote
1
answer
695
views
Shortcode with a foreach and arguments
I'm digging into shortcodes expert level 😄
I made some searches and I really think I'm on the right path but I need your help because something is missing me (probably because I don't know very well ...
0
votes
1
answer
36
views
get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title
function custom_pic_alt( $attachment_ID ) {
// Get ALT
$thumb_alt = get_post_meta( $attachment_ID, '_wp_attachment_image_alt', true );
// No ALT supplied get attachment info
...
0
votes
0
answers
318
views
Check if current post in loop is last on current page
I am developing a WordPress theme and want to determine if I am at the last post of the current loop page.
<?php get_header(); ?>
<main id="main">
<!-- ======= Blog ...
1
vote
0
answers
28
views
Using the_post_thumbnail resets current loop item ID
I'm facing a very strange issue when displaying custom loop items (from a new WP_Query) on a static homepage template.
Each item has a thumbnail, title, and some meta info. Every time I use ...
0
votes
1
answer
58
views
How to loop custom post_type from (a) specific category(ies)?
I'm using this code which works really fine to list quite everything I need as Featured image and title, from my custom posts "portfolio".
<?php
$args = array(
'posts_per_page' ...
0
votes
1
answer
24
views
Shortcode with loop stacks output
I found some shortcode to display a custom post type, but it's not display how I envisioned.
Originally the shortcode only added the title from my custom post type, but I modified it to also show the ...
0
votes
1
answer
39
views
Custom Loop with certain number of one category
I have a custom loop that shows 120 posts in total on a certain page. The posts are from several categories. That works perfectly. But I need to change it.
I need:
120 posts only of the category 2
...
1
vote
0
answers
218
views
Split loop to load WordPress gallery into Bootstrap modal and carousel
I have created WordPress coding to loop through gallery images from a post, create a thumbnail gallery display in two cols (that resizes to one col at the mobile size, since the default WordPress ...
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 ...
1
vote
1
answer
80
views
How to order posts by meta_value created inside loop?
Inside the WP_Query, I'm trying to order posts by price.
The problem is that the price value is not manually defined inside an ACF or so, but it comes from an api call made while looping trough posts, ...
0
votes
1
answer
19
views
Add class every 4 post like , class_1, class_2, class_3, class_4 and class_1, class_2, class_3, class_4
Hey guys im trying to add a class every 4 post in wordpress loop like in the image above
im using the simple loop of wordpress, I have investigated about using a counter or modulo but have not found ...
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
1
answer
49
views
how tho change number of posts in loop from specific categories
I am trying to get my home loop query filled like this:
From all posts within all categories: show (just) 1 (most recent) post.
From some specific categories: show 3 (most recent) posts (max).
Sort ...
0
votes
0
answers
22
views
Filtering posts based on three taxonomies
I've built a filterable post listing where the user can filter based on two taxonomies, this is working but I now want to add a third taxonomy to the filter, but I think the logic I'm using isn't very ...
0
votes
1
answer
497
views
Looping Through Categories of a CPT
I am trying to create tabs using the Foundations framework, outputting posts from a custom post type called testimonial and filtering them through their assigned custom category called filed-under. ...