Tagged Questions
0
votes
1answer
21 views
Control content before and after custom post type loop
I am trying to create a left nav menu that contains a couple of different taxonomy lists of a custom post type. For example, the left menu might look like this...
<h2>New Stuff</h2>
...
0
votes
1answer
23 views
Looping taxonomy in taxonomy?
So I have a CPT of references (like a dictionary kind of format for music).
In it there are two taxonomies: medium_reference and reference_letter.
The reference_letter lists letters A-Z, while ...
1
vote
2answers
65 views
Output 2 items within the Loop
I have a query that loops through <li>'s and displays the number of <li>'s I have. Is there a way I can make the loop pull 2 <li>'s at a time rather than one?
// 5 list items
...
0
votes
2answers
39 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', ...
0
votes
1answer
66 views
Specific Loop For 2 <div> Within Each <li>
I need to create a loop that can logically be described as the following for a carousel:
Requirements:
3 Loops
2 Posts Per Loop
No Duplicates
Order by Post Date
Visual:
< Start Loop #1 >
...
0
votes
1answer
90 views
Using loop pagination on single.php
I want the main front-page loop to show in a section on both index.php AND single.php templates, with pagination.
Pagination works fine on the homepage, but not on single posts. This is the code ...
0
votes
1answer
54 views
How to break up php code to avoid echo
I have this php code I am using to list all post (titles) with the taxonomy categories names, and its working fine however I will like to break it up and avoid using echo within the php code so that I ...
0
votes
0answers
30 views
For loop logic for combinations
I have WP E-Commerce installed and I'm moving whole it's dashboard to frontend.
I have everything ready and am on the last part. In fact I thought this part was ready, until I added two variations, ...
0
votes
0answers
19 views
Looping through textfield submission and saving each element to the corresponding element
The following code loops through posts, and than displays some information about them. Next to this displayed information is a text field in which the user can enter text for each element.
When the ...
0
votes
1answer
37 views
Remove the_content From Loop
I'm trying to display a custom loop with only certain elements in it.
My loop currently contains the title, creation date, author & content.
However I am trying to remove the content for each ...
0
votes
3answers
43 views
Trying to display ads on only a third of posts in a loop. Keep getting Error 500?
I'm thinking it's just a PHP code error, but for some reason the following code won't work, it just keeps giving me Internal Server Error 500
<?php
$ajfl_adLuck = rand(1,3);
if ($ajfl_adLuck ...
0
votes
1answer
194 views
Why WP_Query('showposts=5') shows only 1 post?
I am trying to do a simple query to get the latest 5 posts into an unordered list, but this is only showing 1 result even though I have several posts. I even did an offset, but it shows the next post ...
0
votes
2answers
60 views
Is the 404 page automatically displayed if a loop returns nothing?
If you have an index.php with a loop such as:
if(have_posts()){
while(have_posts()){
the_post();
}
}
And nothing is returned, you would generally do a:
if(have_posts()){
...
0
votes
1answer
59 views
Custom Meta Box If Else Statement
I have created a custom meta box for posts and I need to display said data. I have been using the below method to display the data, But I am in need of a slightly different solution.
<a ...
-3
votes
1answer
47 views
$_html is empty when var dumped
So I have run across a bizzar issue, in which I know is working as i expect it to in terms of the array values, yet the _html variable returns something like string(29) " " which to my knowledge ...
0
votes
1answer
29 views
Limiting the amount of posts retrieved by the loop
I'm using a theme which has its own homepage which is created using the theme options (i.e. so can't add content under Pages) so I'm trying to add the latest posts on the page, I have copied the code ...
-2
votes
1answer
86 views
how to use the values from print_r()? [closed]
I was trying to find a way on how to get the values from print_r(), I already typed-in the same scenario looking for the same problem and answers but only to find out answers that will only print the ...
3
votes
1answer
87 views
Search widget breaks when using multiple loops?
I have created wordpress template that uses two loops via WP_Query object. Everything works fine except Search widget. I've been pulling my hairs out for three days now Googling like a madman,but ...
0
votes
1answer
149 views
Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
I have a made a custom post type called "Member Resources" the posts under this CPT have a few taxonomies such as categories and tags.
Tags = "Diversity"
Categories = "Guidance"
When I go to the ...
-2
votes
1answer
61 views
Pagination not working properly
I have a list of posts from a category as seen here in this example. The problem is, if you scroll down to the bottom and click older, you'll see that the posts on the page have not changed at all, ...
0
votes
2answers
114 views
How do I remove a category from a wordpress loop>
I have a question. I need to have, in my archive.php file, a exclusion of a specific category. given what I have now, how would I make that happen?
Here is the code:
<?php
...
1
vote
2answers
47 views
Knowing the total number of posts before to get into the loop
Is there a way to know the total number of posts before the loop starts? I'm thinking in use two loops. The first will do the counting, while the second one will handle the content. However, I don't ...
-2
votes
2answers
239 views
How do I remove blog entries from home page Twenty Eleven child theme?
I have been wrestling with this for some time. I've read the documentation about creating a separate home page and posts page, and so on, and I have managed to create a landing page, and a blog.
...
0
votes
1answer
95 views
Post from one loop in different containers?
Is there a way to output posts from a single loop in multiple containers?
Ideally I'd like to have the posts title/meta/content etc alternate between first-container and second-container, but I can't ...
0
votes
2answers
79 views
Getting Post Permalink Outside of Loop Not Working
I'm trying to get post's permalinks outside of the loop via a wordress plugin. Nothing seems to be working. Here is the original code that does not link to any permalink.
public function ...
4
votes
1answer
311 views
Getting only direct child pages in WordPress with get_pages
I am trying to fetch all direct children of a page. But I am getting all children and grand children as well. Any ideas?
PHP Source:
$args = array(
'child_of' => $post->ID,
...
0
votes
2answers
353 views
Custom single.php files for different post formats
I have 3 custom post formats. One is for image, one for video, and, one for gallery besides the default post and they each have a view comments link on the bottom right corner at the end of the post.
...
1
vote
2answers
70 views
I would like to have different styles for my posts based on the content of each post
Here is my wordpress theme to check out(its not completely finished):
http://benlevywebdesign.com/wordpress/
This is my first time working with php/wordpress and making themes so keep that in mind.
I ...
0
votes
1answer
38 views
Adding if statement to content for homepage
I have an if statement already in my loop to display content based on post type. I was wondering if there was a way that I could say to ignore that section if it is the front page/homepage. Here's a ...
4
votes
2answers
399 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
1answer
44 views
Tables not showing divs and loop/php items
I know this is an absurd questions, as who uses tables anymore? I got handed this and just need to make it work really. I don't know anything about tables so it's been a learning experience.
I ...
0
votes
1answer
111 views
How do I filter a custom post type loop by a field?
OK, very simple task, I'm just not good at PHP.
I have a page where I want to list some staff using a styled list. Here is the page all working fine, I just need to divide the results - ...
0
votes
1answer
79 views
Query Custom Post Type by Tag
Kinda confused on this.. hoping someone can help.
I have custom post type named "Providers" that I want to pull entries from that are tagged "highlighted". I enabled tag support on the custom post ...
0
votes
1answer
76 views
Checking if Post Title is Unique as Loop Criteria
I'm trying to make a seemingly simple bit of php (it output's to a Gravity Forms field, but that's basically irrelevant).
I'm using Gravity Forms to create posts, which I can do easily, however I ...
0
votes
1answer
154 views
How to call the_author_meta and make it work?
I am developing an author badge for my Wordpress site and I am learning how to call meta functions (needs to be within The Loop). The meta functions that I am calling are author bio related, like ...
0
votes
1answer
68 views
Search.php gets metadata from first post
I've got this in header.php in <head> section:
$page_color = get_post_meta($post->ID, 'page_color', true);
It works fine because it gets correct page_color for posts and pages but when I ...
0
votes
1answer
245 views
Loop with slider (slider not loading)
In my slider.php I have a loop that calls for a custom post type. That custom post type has a meta box for a slide url (link/title/etc). I can see the loop and everything else is working because in ...
1
vote
0answers
116 views
List authors with the last post title and order by last post date
I want to list authors with last post data and order them by last post date. Now i have this codes but i don`t know how to edit them.
// Selects from tables wp_users and wp_posts, selecting published ...
0
votes
2answers
94 views
How can I remove the first two words and shorten get_the_title()
Some of my posts' titles have leading words, followed by a colon. I am removing the leading words and the column of every post title in the loop with the following:
<?php
$title = ...
0
votes
1answer
237 views
Alter secondary loop to exclude posts from current page category
The below code is taken from sidebar.php where it outputs random posts from multiple categories and excludes the current post from showing up. This works great but how do I alter this loop to exclude ...
0
votes
2answers
82 views
variable value disappears in a second loop
i can't manage to "see" the value of $originalArticle in echo '/'.$originalArticle.'== &'.$sameArticle; : i tried with "global" before, but it does not work... The output is for example :
/== ...
0
votes
1answer
418 views
How to create Loop code for Menu using Wordpress?
I have created a menu called "My Menu" in wordpress using Menus feature provided under Wordpress admin panel. I have added 3 pages into it named Page A, Page B, Page C.
I have applied featured image ...
1
vote
1answer
180 views
How does the ternary operator work in the wordpress loop post?
Okay so I kind of understand that ternary operators work like
condition ? TRUE : FALSE
However I'm looking a simple loop to get my posts that I have
<?php if (have_posts()) :
...
1
vote
2answers
154 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
1answer
313 views
Facebook “like” open graph meta in header.php
I would like to add open graph meta tags to my header.php, but can someone explain how this works if header.php comes before my loop with the relevant information??
<meta property="og:title" ...
0
votes
3answers
410 views
Add class to every other posts using get_posts
I am currently using this little loop to display a list of posts using the "events" custom post type
<?php global $post; // required
$args = array('post_type' => 'events');
...
0
votes
1answer
131 views
the_post(); prints out style text into my HTML?
Every time I use the_post(); in my theme code, the following is echo'ed into my pages:
<style type="text/css">
<!--
.formTitle {
font-size:20px;
font-weight:bold;
...
0
votes
1answer
66 views
Last class on last headline?
I have the following code which should add a last class to the fourth post but doesn't appear to be, what is wrong with this coding? It show's 4 posts fine but the fourth one doesn't have the class ...
0
votes
1answer
270 views
How to hide all child pages with post_query?
i have a page template as start page(home.php). i use a 2 columns grid to display all pages on that home.php with title and excerpt. unfortunately also my child pages are shown and i can't figure out ...
1
vote
2answers
633 views
Very Slow Page - How to Optimize # of Queries?
EDIT 12/19/2011
Thank you again Ijaas. Everything is working except for the order of the days. It is ordering the groups of days by the publish order. If an older post has a newer date in its ...
