All Questions
40 questions
0
votes
1
answer
40
views
Custom post type loops with different page templates
My website has two different page templates. Each page template contains a different custom post type. The posts from the loops can be loaded by AJAX to load more.
This is the common code that I run ...
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
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
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 ...
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
2k
views
cURL needing to loop through all "next_page"
When using cURL, how would I be able to include a call inside my get_all that basically will loop through all the next_pages, get the data and then outpul it to $response->data when the "next_page" ...
1
vote
1
answer
449
views
get author_name from queried post
All I'm trying to do is, get the author name of the current post and set it's name as a tag. I tried changing author_id to author_name but didn't really get anything back.
wp_set_post_tags should ...
0
votes
2
answers
91
views
use loop to return blog details
I want to return information about a blog. It could be, author name, title, date, country whatever just to test.
<?php
$post_id = get_the_ID();
while ($post_id != 0)
{
...
1
vote
1
answer
777
views
Get first URL from post content
Basically all I want to do is if the post format is "link" rather than link to the post from the blog index, link to the link pasted within the post content.
In my index.php I have:
<h3>
<...
0
votes
2
answers
284
views
WordPress Ajax filter: Create two loops for different output styles?
I have two different pages, with filters. Those two pages, have different layouts and styles.
I have three different filters for one page, where the output and style is the same.
For the “newsfilter”...
1
vote
1
answer
8k
views
How to get current post category details inside "loop"?
I have a rather simple problem I can't solve. I have custom styling for my cards and one of the elements of the cards is the category, when I access the_category() from the Loop it comes with its own ...
0
votes
0
answers
965
views
How can I get my pagination loop to display the correct number of total pages?
Currently my pagination is showing 7 posts on the first page and 6 on each page after. This is what I want. The current readout looks like this:
.
The total count of my pages changes as soon as I ...
-2
votes
1
answer
179
views
Loop on a wordpress Page instead of content coming from the WP text editor
I have created a page template:
<?php /* Template Name: homedefault */ ?>
But Instead of text coming from here i.e. wp editor:
I want it to come from the loop:
<?php if ( have_posts() )...
0
votes
2
answers
1k
views
How to sort (orderby) a query done by a template function before the 'foreach' loop?
How can I sort an array of elements being hold on a query done by a template function, just before the output starts on a foreach loop?
I wanted to order my elements by the Post Title. Here is my code:...
11
votes
1
answer
16k
views
What is This esc_html_e() i wordpress php?
why do developers use
<?php esc_html_e() >?
in 404 pages, what does it mean, how does it works?
0
votes
1
answer
85
views
Custom Pagination is Broken
Good Afternoon!
I am working on adding pagination to a website and currently it is working fine but for some reason the function loads an extra page. We have 7 posts, and I set it to display 4 posts ...
1
vote
0
answers
41
views
Blog posts repeat
Good Afternoon!
I have having an issue on a site I am working on where in that the blog posts "repeat" and by that I mean they are being displayed twice. Ideally I would like the page to work as ...
0
votes
2
answers
3k
views
Loop increase number
$args = array(
'post_type' => 'events',
'order' => 'ASC',
);
$wp_query = new WP_Query($args);
?>
<script type="application/ld+json">
{
"@context":"http://schema.org",
"@...
0
votes
1
answer
80
views
How fix error in the WordPress loop?
I do not fulfill the condition for the appearance of the button below, what do I do wrong?
<?php
query_posts( array(
'post_type' => 'post',
...
1
vote
0
answers
292
views
how to refresh div on template part?
i'm keep learning about wordpress development and i've developed this template-part and loop and i need that entire div#dreams-gallery refresh after a period of time, let's say 10 seconds.
Here's my ...
0
votes
1
answer
455
views
Calling function in loop causes repeat data
I am trying to display post numbers (for ranking purposes) on my feed, this was accomplished by calling the function that contains my wordpress loop and returning an incremented value. However, by ...
0
votes
1
answer
604
views
My query keeps looping infinitely ! how to stop it?
in my plugin I need to retrieve posts published by admins to display them in the back-end under posts so .. i fetch the admins ids through get_users and it's fine but whenever i try to build a query ...
0
votes
1
answer
139
views
Retrieving specific images from Media Library
I developed a theme in which I show a Bootstrap carousel filled with sponsor images.
At the moment the sponsor-images are hardcoded like this:
<div class="item active">
<div class="row ...
0
votes
1
answer
4k
views
How to add active class to custom menu using while loop and wp_list_pages
I am running wp_list_pages through a while loop to create a custom menu. By running it through a loop I can target specific elements to show. I need to figure out how to either target the classes ...
3
votes
1
answer
1k
views
Displaying post per day
Currently I have the code displayed below.
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
<a class="...
1
vote
0
answers
342
views
Can't find infinite loop cause
I am working on the below function which will eventually create a set of posts based on meta data entered into a "parent" post. I'm running into an infinite loop when hitting the save button, which I ...
1
vote
1
answer
112
views
Checking array against author id in loop
So I have a function in Wordpress with a plugin that returns a list of friends as an array. The function code is here:
function friends_get_list($tmp_uid, $friend_status=1) {
global $wpdb;
$...
0
votes
0
answers
441
views
Modify category archive page loop on functions.php
I was able to modify the query on the category archive page using
global $wp_query;
$args = array_merge( $wp_query->query_vars, array(
'tax_query' => array(
array(
'...
1
vote
2
answers
2k
views
Most elegant way to enqueue scripts in function.php with foreach loop
I wonder is there a way of running wp_register_script and enqueue with the help of foreach loop to manage label and dir?
For example,
function wbs_app_components(){
$scripts_list=array(
...
0
votes
4
answers
13k
views
How can I loop into two different DIVS without repeating the DIVs
I am having a little trouble trying to figure out how I can accomplish this: I have a container with two colums in it, a right and a left column. Each column will have 3 posts with a short excerpt ...
0
votes
1
answer
43
views
Pagenav Not appearing on custom Template
I've just finished building a custom page template using the following code. The issue is the pagenav doesn't work - But works on every other page with multiple posts. I want this one to appear if ...
-1
votes
1
answer
417
views
Options.php loop won't show!
I'm creating an options panel for a theme on my localhost that's stored within the options.php file. My options panel will have two main loops. The first is to list the different sections and the ...
0
votes
2
answers
3k
views
Strip <p> from <blockquote> or something better?
Looking for some help on something that has me really contemplating not using blockquotes for the moment!
I have this code:
<?php
$show_after_p = 1; $content = apply_filters( 'the_content', ...
4
votes
2
answers
1k
views
Build a content and excerpt grid loop with paging and options for # of posts
What I'd like to do: on index.php, a loop that shows a selectable number of full posts using the_content and then below that shows a selectable number (the number of posts can be hardcoded in the ...
0
votes
2
answers
163
views
Way of getting queried loop before the query with a filter hook?
Is there a way to get the results of a loop with a filter before the code for the loop is performed in the structure of your code?
My markup is something like this:
<body>
<div>
/* ...
1
vote
2
answers
370
views
How to speed up a wordpress function with multiple loops?
I am a PHP novice and wrote this function. It is an alphabetical navigation which shows only the letter that have posts in both that letter and the currently filtered "genero" taxonomy term.
I use ...
1
vote
1
answer
931
views
Custom excerpt function re-factoring
This may be more of a php best practices question, but here goes...
I am using a custom excerpt trim function:
function new_wp_trim_excerpt($text) { // Fakes an excerpt if needed
global $post;
...
1
vote
1
answer
379
views
Show css depending on activity type in BuddyPress activity-loop [closed]
I was wondering if anyone knew of a way to show specific styles to the activity loop depending on the activity type?
This is what I had an idea of:
function mycustom_act_type() {
if ('...