A generic term referring to the process of retrieving information from a database.

learn more… | top users | synonyms

0
votes
1answer
2k views

Adding custom field values to wp_list_pages

I am trying to pull in a custom field vales for each page while using wp_list_pages. For example I want to list out each portfolio item in my sidebar but also show why type of work it is by pulling ...
0
votes
2answers
3k views

How can i show all categories using wp query?

<?php $recent = new WP_Query(); ?> <?php $recent->query('cat=1&showposts=2'); ?> With what can i replace cat=1 to show posts from all the categories?
-1
votes
1answer
174 views

Add content in between of foreach

I have the following foreach witch gets all the content in several groups. I am using Magic Fields. <?php $omtaleseksjoner = get_group('Seksjoner'); foreach($omtaleseksjoner as $seksjoner){ ...
0
votes
2answers
547 views

Custom Field Date Problem

I have a custom field called expiry_date with a value of let's say 2010-12-11 00:00:00. What I would like to do is, in my query loop, only return posts with this expiry_date custom field attached to ...
2
votes
3answers
523 views

Search and replace text across all posts

I had used the ZD Video Plugin for WP a long time, and now, since my move to WP 3.0.2, it doesn't work anymore. To embed a YouTube video using the plugin, I would just write ...
49
votes
4answers
82k views

How to display sql query that ran in query?

I have come across a function before that displayed the exact SQL code that was used in a loop for example, but can't remember. Can anybody tell me that function? Cheers
0
votes
2answers
263 views

What is wrong with my wp query, cant exclude the category that i want

query('showposts='.$display_count.'&orderby=comment_count&category__not_in=14'); It wont exclude the category that i want. Posts still show up
15
votes
4answers
18k views

Pagination not working with custom loop

I've got a custom loop that I'm using to display some Real Estate listings that will be available within 60 days. I'm calling it with the following function: <?php $sixtydays = date('Y/m/d', ...
2
votes
1answer
210 views

WP database error for comments_popup_link()

I'm using the comments_popup_link() function to show the number of comments for each post in a loop. <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if ( ...
1
vote
2answers
1k views

Display posts separated by Category in Author's page

I created an author's page using: <?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); else : $curauth = get_userdata(intval($author)); endif; ?> ...
0
votes
1answer
743 views

SQL error with custom query

I'm trying to create a custom post query for sorting posts that have been voted "thumbs up". I'm joining my custom "wp_post_votes" table (which stores the number of votes each post received) with ...
0
votes
1answer
459 views

Placing a widget with $wpdb query

I'm getting the feeling that adding Widgets via MySQL query is not as simple as I thought. I was under the impression all data is stored in the options table, but it seems like I was wrong. Any idea ...
2
votes
1answer
354 views

mysql query paging

Hi I have made an sql query that gets several posts according the parameters that i've selected. I'm showing these posts but the inner paging within wordpress doesnt do anything. It shows me that ...
0
votes
1answer
2k views

Why can't I exclude private posts from this query?

My WP query to fetch some custom posts should exclude private posts, but this query is returning all posts, not just public ones: $wp_query = new WP_Query( ...
1
vote
1answer
4k views

SQL query to select posts from multiple categories

I have built a query to select posts within a category. Works fine. But when I choose to add a secondary filter to exclude a category, the query return the same result set, as if the secondary ...
0
votes
4answers
2k views

How to filter post from categories only if the posts appears in one of them, not the other?

The scenario is, some posts have one category, ok. Some others have more than one category. I must create post with content and also slideshow thumbnails for use with Nivo plugin gallery. Ok. I want ...
258
votes
7answers
95k views

When should you use WP_Query vs query_posts() vs get_posts()?

It seems like half the tutorials in the Codex and around the blogosphere use query_posts() and half use WP_Query. What's the deal?
0
votes
1answer
408 views

WP_Query older new links navigation?

I'm doing a custom query using WP_query to get posts from a specific category, but for some reason navigation links for the list don't appear. Is there a way to get the newer/older links to show up ...
14
votes
4answers
4k views

Show a different number of posts per page depending on context (e.g., homepage, search, archive)

In the Reading Settings, there is place to set the number of posts shown that affects the number of posts shown in all contexts. I'd like to show instead a certain number of posts on the homepage, and ...