qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
9,476 | <p>I have written a basic <a href="http://wordpress.org/extend/plugins/bitvolution-image-galleria/" rel="nofollow">gallery plugin</a> that uses <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style" rel="nofollow">wp_enqueue_style</a> to include a stylesheet on the page. I'd like for the WordPress the... | [
{
"answer_id": 9487,
"author": "Tom",
"author_id": 24,
"author_profile": "https://wordpress.stackexchange.com/users/24",
"pm_score": 1,
"selected": false,
"text": "<p>I thought I'd post my workaround which I'm using until I know the answer to the question...</p>\n\n<p>My workaround is:</... | 2011/02/16 | [
"https://wordpress.stackexchange.com/questions/9476",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24/"
] | I have written a basic [gallery plugin](http://wordpress.org/extend/plugins/bitvolution-image-galleria/) that uses [wp\_enqueue\_style](http://codex.wordpress.org/Function_Reference/wp_enqueue_style) to include a stylesheet on the page. I'd like for the WordPress theme to be able to override the style of the plugin whi... | First issue - you have dependency backwards. Depending on something means loading **after** dependency, while you want earlier.
Second issue - theme's stylesheet doesn't actually use enqueue, it is usually codded directly in `header.php` file of theme. And since it seems to come before `wp_head()` call - you have no h... |
9,485 | <p>My user database is full up with robots. Is there a useful SQL command to delete all the users that either a) have posted a comment marked as spam by Akismet or b) never posted a comment ?</p>
| [
{
"answer_id": 9519,
"author": "MikeSchinkel",
"author_id": 89,
"author_profile": "https://wordpress.stackexchange.com/users/89",
"pm_score": 2,
"selected": false,
"text": "<p>Hi <strong>@Nick Loman:</strong> </p>\n\n<p>There is not one command, but several. Be care though to back up yo... | 2011/02/16 | [
"https://wordpress.stackexchange.com/questions/9485",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | My user database is full up with robots. Is there a useful SQL command to delete all the users that either a) have posted a comment marked as spam by Akismet or b) never posted a comment ? | Hi **@Nick Loman:**
There is not one command, but several. Be care though to back up your database before running this because there's a tiny chance something in your database differs from mine, especially after a .1 upgrade beyond 3.0 and thus it may not work perfectly and you'll have to restore.
```
DELETE FROM wp... |
9,488 | <p>I was able to install and setup quite easily NetBeans 6.9.1 and Xdebug on my local environment, based on PHP 5.3.0 (XAMPP).</p>
<p>My problem now is the following: if I put a breakpoint on Wordpress's index.php or other Wordpress core PHP files, NetBeans correctly stop at desired position. If instead I put a breakp... | [
{
"answer_id": 9524,
"author": "MikeSchinkel",
"author_id": 89,
"author_profile": "https://wordpress.stackexchange.com/users/89",
"pm_score": 0,
"selected": false,
"text": "<p>Hi <strong>@Drake:</strong></p>\n\n<p>Stupid question, I know, but have you <em>\"activated\"</em> the plugin? ... | 2011/02/16 | [
"https://wordpress.stackexchange.com/questions/9488",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36/"
] | I was able to install and setup quite easily NetBeans 6.9.1 and Xdebug on my local environment, based on PHP 5.3.0 (XAMPP).
My problem now is the following: if I put a breakpoint on Wordpress's index.php or other Wordpress core PHP files, NetBeans correctly stop at desired position. If instead I put a breakpoint on a ... | There is an easy solution with a Firebox extension [Xdebug Helper by Brian Gilbert](https://addons.mozilla.org/en-US/firefox/addon/xdebug-helper-for-firefox/). This sets cookies for the `xdebug` session which allows you to use `xdebug` within your WordPress plugins.
There are also extensions for Chrome, Safari and Ope... |
9,490 | <p>I am creating a child theme using twentyten as my base. I am looking for a way to remove the features of adding custom header and background without touching <code>functions.php</code> file in the parent theme.</p>
<p>no luck with this :(</p>
<pre><code>function my_child_theme_setup() {
remove_theme_support('c... | [
{
"answer_id": 9492,
"author": "Cronco",
"author_id": 1695,
"author_profile": "https://wordpress.stackexchange.com/users/1695",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/remove_theme_support\" rel=\"nofollow\">remove_theme_suppo... | 2011/02/16 | [
"https://wordpress.stackexchange.com/questions/9490",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1555/"
] | I am creating a child theme using twentyten as my base. I am looking for a way to remove the features of adding custom header and background without touching `functions.php` file in the parent theme.
no luck with this :(
```
function my_child_theme_setup() {
remove_theme_support('custom-background');
remove_t... | Both the header and background image features setup some globals in order to work, unsetting those globals seems to have some effect, and at the least removes them from the administration side.
```
add_action('after_setup_theme', 'remove_theme_features', 11 );
function remove_theme_features() {
$GLOBALS['custom_b... |
9,505 | <p>I am trying to hide a certain amount of menus for a client. Right now I am using the following code and it is doing its job well, but it removes it for everyone as far as I can tell. As in all roles.</p>
<pre><code>function remove_menus () {
global $menu;
$restricted = array(__('Dashboard'), __('Media'), __('Li... | [
{
"answer_id": 9511,
"author": "Jason Rhodes",
"author_id": 871,
"author_profile": "https://wordpress.stackexchange.com/users/871",
"pm_score": 2,
"selected": false,
"text": "<p>Use the <code>current_user_can()</code> function to build that <code>$restricted</code> array in pieces, befor... | 2011/02/16 | [
"https://wordpress.stackexchange.com/questions/9505",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I am trying to hide a certain amount of menus for a client. Right now I am using the following code and it is doing its job well, but it removes it for everyone as far as I can tell. As in all roles.
```
function remove_menus () {
global $menu;
$restricted = array(__('Dashboard'), __('Media'), __('Links'), __... | Use the `current_user_can()` function to build that `$restricted` array in pieces, before you pass it through that unset loop. You'll have to use capabilities, and not role names, to make it work. |
9,564 | <p>What is the best way to strip <em>the_content</em> of html tags and needless spaces on the front end? I'm building a special use theme that needs to allow users who can edit_post to make changes on the front end, but I only want this text area to support plain text.</p>
<p>My current code:</p>
<pre><code><?php ... | [
{
"answer_id": 9566,
"author": "edelwater",
"author_id": 576,
"author_profile": "https://wordpress.stackexchange.com/users/576",
"pm_score": 1,
"selected": false,
"text": "<p>The HTML tag \"textarea\" .... takes into account spaces.....</p>\n\n<p>e.g.: <a href=\"https://stackoverflow.com... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9564",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1057/"
] | What is the best way to strip *the\_content* of html tags and needless spaces on the front end? I'm building a special use theme that needs to allow users who can edit\_post to make changes on the front end, but I only want this text area to support plain text.
My current code:
```
<?php if ( !current_user_can( 'edit... | You will have to worry about formats beeing over written.
Ex.
`<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. ____Stet clita kasd gubergren, no sea t... |
9,573 | <p>Let's say I have a single.php file with a certain layout (graphic intensive). I want to create a sort of plain-text version of the same page that is only called when the user clicks the provided link. I can create single-plaintxt.php but how would I go about generating a link and/or function that would only load t... | [
{
"answer_id": 9595,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 4,
"selected": true,
"text": "<p>you can do it like this:</p>\n\n<pre><code> //add my_print to query vars\nfunction add_print_query_vars($var... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9573",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1663/"
] | Let's say I have a single.php file with a certain layout (graphic intensive). I want to create a sort of plain-text version of the same page that is only called when the user clicks the provided link. I can create single-plaintxt.php but how would I go about generating a link and/or function that would only load the pa... | you can do it like this:
```
//add my_print to query vars
function add_print_query_vars($vars) {
// add my_print to the valid list of variables
$new_vars = array('my_print');
$vars = $new_vars + $vars;
return $vars;
}
add_filter('query_vars', 'add_print_query_vars');
```
then add a template redi... |
9,576 | <pre><code><?php
/*
Template Name: Projects
*/
?>
<?php get_header();?>
<section id="content">
<section id="main">
<?php
$loop = new WP_Query(array('post_type' => 'projects', 'posts_per_page' => 4));
$i=1;
while ... | [
{
"answer_id": 9626,
"author": "John P Bloch",
"author_id": 11,
"author_profile": "https://wordpress.stackexchange.com/users/11",
"pm_score": 4,
"selected": false,
"text": "<pre><code>wp_pagenavi( array( 'query' => $loop ) );\n</code></pre>\n\n<p>should work with the code above. Don't... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9576",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3239/"
] | ```
<?php
/*
Template Name: Projects
*/
?>
<?php get_header();?>
<section id="content">
<section id="main">
<?php
$loop = new WP_Query(array('post_type' => 'projects', 'posts_per_page' => 4));
$i=1;
while ( $loop->have_posts() ) : $loop->the_pos... | ```
wp_pagenavi( array( 'query' => $loop ) );
```
should work with the code above. Don't hijack the main query if you can avoid it. |
9,577 | <p>I'm looking for a plugin that will let a user tag images attached to a post. My goal is to have a class added to the tag so that I can (hopefully) then create different jQuery image rotators within that post, each using images with a different tag/class.</p>
<p>Edit with more detail:
I found a plugin called <a hre... | [
{
"answer_id": 9626,
"author": "John P Bloch",
"author_id": 11,
"author_profile": "https://wordpress.stackexchange.com/users/11",
"pm_score": 4,
"selected": false,
"text": "<pre><code>wp_pagenavi( array( 'query' => $loop ) );\n</code></pre>\n\n<p>should work with the code above. Don't... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9577",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/49/"
] | I'm looking for a plugin that will let a user tag images attached to a post. My goal is to have a class added to the tag so that I can (hopefully) then create different jQuery image rotators within that post, each using images with a different tag/class.
Edit with more detail:
I found a plugin called [Media Tags](http... | ```
wp_pagenavi( array( 'query' => $loop ) );
```
should work with the code above. Don't hijack the main query if you can avoid it. |
9,584 | <p>I need to showing message in post , but after one month from publish date.</p>
<p>I try to make it before ask you, but I can't</p>
<p>this is my code </p>
<pre><code> $publish_date = $post->post_date_gmt;
$today = date('d-m-Y h:i:s');
$nextMonth = mktime(0 , $publish_date('m')+1... | [
{
"answer_id": 9586,
"author": "Kaaviar",
"author_id": 3071,
"author_profile": "https://wordpress.stackexchange.com/users/3071",
"pm_score": 1,
"selected": false,
"text": "<p>If you're comfortable with the use of Wordpress and plugins you should take a look at WPML plugin at <a href=\"ht... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9584",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2076/"
] | I need to showing message in post , but after one month from publish date.
I try to make it before ask you, but I can't
this is my code
```
$publish_date = $post->post_date_gmt;
$today = date('d-m-Y h:i:s');
$nextMonth = mktime(0 , $publish_date('m')+1 , 0 , 0 , 0,0);
echo '... | If you're comfortable with the use of Wordpress and plugins you should take a look at WPML plugin at <http://wpml.org/>
It's working quite well, even for non-programming users. |
9,587 | <p>I'm using WPML for multi-language website. It works really well except for custom taxonomies.</p>
<p>In admin, I can only join foreign posts to foreign taxonomies (which is exactly what it should do) but on the public area, when retrieving taxonomies it seems that the current language is ignored: I get all taxonomi... | [
{
"answer_id": 10284,
"author": "Kaaviar",
"author_id": 3071,
"author_profile": "https://wordpress.stackexchange.com/users/3071",
"pm_score": 1,
"selected": true,
"text": "<p>I found out that when retrieving the taxonomy you have to do this :</p>\n\n<pre><code> $args = array(\n ... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9587",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3071/"
] | I'm using WPML for multi-language website. It works really well except for custom taxonomies.
In admin, I can only join foreign posts to foreign taxonomies (which is exactly what it should do) but on the public area, when retrieving taxonomies it seems that the current language is ignored: I get all taxonomies.
Any h... | I found out that when retrieving the taxonomy you have to do this :
```
$args = array(
'hide_empty' => true,
'taxonomy' => 'projet_thematique'
);
$thematiques = get_terms('projet_thematique', $args);
```
The thing was done by adding the 'taxonomy' as an argument as well.
I hope it will b... |
9,593 | <p>I have a custom post type called 'projects' (<a href="http://pastebin.com/jRc7BFCR" rel="nofollow">pastebin</a>) and I have a page called Projects set up in my dashboard which is set to display the Projects template. (<a href="http://pastebin.com/jTSbEqy5" rel="nofollow">pastebin</a>)</p>
<p>The problem is when I u... | [
{
"answer_id": 9605,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 0,
"selected": false,
"text": "<p>Its a better way, you build your own paginatin:</p>\n\n<pre><code>echo paginate_links(array(\n 'current' => 5,\... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9593",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3239/"
] | I have a custom post type called 'projects' ([pastebin](http://pastebin.com/jRc7BFCR)) and I have a page called Projects set up in my dashboard which is set to display the Projects template. ([pastebin](http://pastebin.com/jTSbEqy5))
The problem is when I use WP\_PageNavi to incorporate pagination and click on page 2,... | As you can see in the rewrite analyzer, `/projects/page/2/` sets `projects=page&page=/2` instead of `pagename=projects&paged=2` as we would like. So you just need to add a rewrite rule for this special case (in the `register_projects()` function, after you register your custom post type, would be a good place):
```
ad... |
9,599 | <p>I'm using the following code I got from the <a href="http://codex.wordpress.org/Function_Reference/get_pages" rel="nofollow">Wordpress codex</a>:</p>
<pre><code><?php // Displaying Child pages of the current page in post format
$mypages = get_pages('child_of='.$post->ID.'&sort_column=post_date... | [
{
"answer_id": 9600,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 2,
"selected": false,
"text": "<p>you need to add <code>setup_postdata($page);</code> \ninside your foreach loop and then </p>\n\n<pre><code><... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9599",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/781/"
] | I'm using the following code I got from the [Wordpress codex](http://codex.wordpress.org/Function_Reference/get_pages):
```
<?php // Displaying Child pages of the current page in post format
$mypages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');
$count = 0;
... | You're not inside a regular loop, or at least not one where global post variables are set, so `the_post_thumbnail` does not have an ID to fetch a thumbnail for..
Use `get_the_post_thumbnai( $page->ID )` instead and it should work fine. |
9,623 | <p>I have a custom post type "Listing" and I want to get all Listings that have a custom field <code>gateway_value != 'Yes'</code>, and order the results by another custom field, <code>location_level1_value</code>. I can get the queries to work separately, but I can't combine them:</p>
<h1>Query 1 (sort by location):... | [
{
"answer_id": 9642,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 2,
"selected": false,
"text": "<p>Just like Jan said in new WordPress 3.1 you can use <code>meta_query</code> but until that will come out you c... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9623",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1118/"
] | I have a custom post type "Listing" and I want to get all Listings that have a custom field `gateway_value != 'Yes'`, and order the results by another custom field, `location_level1_value`. I can get the queries to work separately, but I can't combine them:
Query 1 (sort by location):
===========================
```
... | You could use the query to filter the content as you intended by using the 'meta\_query' with filtering options, and for the order part, just add/modify the following parameters:
* 'orderby' => 'meta\_value'
* 'meta\_key' => 'location\_level1\_value'
* 'order' => 'ASC'
```
$wp_query = new WP_Query( array (
'post_... |
9,625 | <p>I have to update the information of 1500 members of my clients Wordpress site. I'm using a membership to manage paidd subscriptions and I have to update the custom fields generated by this Plugin.</p>
<p>I have looked in the MySQL database and found the following meta keys in the wp_usermeta table:</p>
<p>paypal_u... | [
{
"answer_id": 9642,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 2,
"selected": false,
"text": "<p>Just like Jan said in new WordPress 3.1 you can use <code>meta_query</code> but until that will come out you c... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9625",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3245/"
] | I have to update the information of 1500 members of my clients Wordpress site. I'm using a membership to manage paidd subscriptions and I have to update the custom fields generated by this Plugin.
I have looked in the MySQL database and found the following meta keys in the wp\_usermeta table:
paypal\_user, paypal\_st... | You could use the query to filter the content as you intended by using the 'meta\_query' with filtering options, and for the order part, just add/modify the following parameters:
* 'orderby' => 'meta\_value'
* 'meta\_key' => 'location\_level1\_value'
* 'order' => 'ASC'
```
$wp_query = new WP_Query( array (
'post_... |
9,627 | <p><code>wp_delete_attachment()</code> is very comprehensive and wipes every trace of attachment from database and disk.</p>
<p>Is there easy way to keep original file? Forking under another name is not an option, because other functions like <code>wp_delete_post()</code> will still call original version.</p>
| [
{
"answer_id": 9629,
"author": "John P Bloch",
"author_id": 11,
"author_profile": "https://wordpress.stackexchange.com/users/11",
"pm_score": 1,
"selected": false,
"text": "<p>Assuming <code>$attachment_id</code> is the ID of the attachment you want to delete without deleting the file, t... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9627",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/847/"
] | `wp_delete_attachment()` is very comprehensive and wipes every trace of attachment from database and disk.
Is there easy way to keep original file? Forking under another name is not an option, because other functions like `wp_delete_post()` will still call original version. | Year and some later with much improved skills, behold:
```
Keep_Deleted_Attachment_File::on_load();
/**
* Keep original file when deleting attachments.
*/
class Keep_Deleted_Attachment_File {
static private $file;
static function on_load() {
add_action( 'init', array( __CLASS__, 'init' ) );
}... |
9,630 | <p>I have </p>
<pre><code><?php
$folioPosts = get_posts(array('category_name' => 'portfolio', 'numberposts' => 3));
if ($folioPosts->have_posts()) :
foreach ($folioPosts as $folioPost) :
setup_postdata($folioPost);
?>
<article class="col3">
<?php if (has_post_thumbnail()) : ?>
<p&g... | [
{
"answer_id": 9632,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 3,
"selected": true,
"text": "<p><a href=\"https://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts/... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9630",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/794/"
] | I have
```
<?php
$folioPosts = get_posts(array('category_name' => 'portfolio', 'numberposts' => 3));
if ($folioPosts->have_posts()) :
foreach ($folioPosts as $folioPost) :
setup_postdata($folioPost);
?>
<article class="col3">
<?php if (has_post_thumbnail()) : ?>
<p><a href="<?php the_permalink() ?>"><?php the_... | [`get_posts()` returns an array, not a `WP_Query` object.](https://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts/1755#1755) If you want to use `have_posts()` and related functions, use a "raw" `WP_Query` object. |
9,631 | <p>I'm very elated by the fact that it has LaTeX support. I would like to know whether the <code>\begin{align} \end{align}</code> environment could be used, because it looks very good since the equations are aligned. If not how can i make this LaTeX command look better?</p>
<pre><code>\begin{align*}
\int \frac{1}{(2x^... | [
{
"answer_id": 9643,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 1,
"selected": false,
"text": "<p>From the <a href=\"http://en.support.wordpress.com/latex/\" rel=\"nofollow\">link</a> t31os has provided you c... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9631",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I'm very elated by the fact that it has LaTeX support. I would like to know whether the `\begin{align} \end{align}` environment could be used, because it looks very good since the equations are aligned. If not how can i make this LaTeX command look better?
```
\begin{align*}
\int \frac{1}{(2x^{2}+4x-2)^{-\frac{3}{2}}}... | As mentioned, WordPress does not provide general LaTeX support, but usually only mathmode support. Thus you have to use something that works from within mathmode, and not its own environemnt. In this case, there is a very useful one called 'aligned' (with the 'ed' at the end). To render the above in your default WordPr... |
9,645 | <p>I'm probably missing something unless it's really not possible, for some reason I can't get my function to only execute on the <strong>new</strong> and <strong>edit</strong> page of a custom post type (the new not being a problem):</p>
<p>I'm currently using:</p>
<pre><code>if ((isset($_GET['post_type']) &&... | [
{
"answer_id": 9647,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 1,
"selected": false,
"text": "<p>you can try to call on global $post so:</p>\n<pre><code>global $post;\nif ((isset($_GET['post_type']) &&am... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9645",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2393/"
] | I'm probably missing something unless it's really not possible, for some reason I can't get my function to only execute on the **new** and **edit** page of a custom post type (the new not being a problem):
I'm currently using:
```
if ((isset($_GET['post_type']) && $_GET['post_type'] == 'events') || (isset($post_type)... | Ok, total revision on my original answer, which just turned into a mess.
The issue with your code is that you're firing on init, this covers every admin page, and additionally it's too early to check admin vars to work out the current page(though you could just check `$_GET` if you really need to run code that early)... |
9,667 | <p>How can I get WordPress post content by post id?</p>
| [
{
"answer_id": 9668,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 9,
"selected": true,
"text": "<p>Simple as it gets</p>\n\n<pre><code>$my_postid = 12;//This is page id or post id\n$content_post = get_post($my_... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9667",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2215/"
] | How can I get WordPress post content by post id? | Simple as it gets
```
$my_postid = 12;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
``` |
9,669 | <p>get_terms allows me to get all taxonomy values, but how do I limit this to a certain post?</p>
<p>I don't see anyway to feed a specific post ID to get_terms: <a href="http://codex.wordpress.org/Function_Reference/get_terms" rel="nofollow">http://codex.wordpress.org/Function_Reference/get_terms</a></p>
<p>Perhaps t... | [
{
"answer_id": 9668,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 9,
"selected": true,
"text": "<p>Simple as it gets</p>\n\n<pre><code>$my_postid = 12;//This is page id or post id\n$content_post = get_post($my_... | 2011/02/17 | [
"https://wordpress.stackexchange.com/questions/9669",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1341/"
] | get\_terms allows me to get all taxonomy values, but how do I limit this to a certain post?
I don't see anyway to feed a specific post ID to get\_terms: <http://codex.wordpress.org/Function_Reference/get_terms>
Perhaps there is another way to achieve this? | Simple as it gets
```
$my_postid = 12;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
``` |
9,690 | <p>If possible I want to insert the ID of a post(from a custom post type) into the html of the post itself when its loaded in the viewport.</p>
<p>The scenario is that the content of the custom post type is surrounded by a <code><div></code>. I want to append an 'id' to the <code><div></code> that includes... | [
{
"answer_id": 9691,
"author": "edelwater",
"author_id": 576,
"author_profile": "https://wordpress.stackexchange.com/users/576",
"pm_score": 1,
"selected": false,
"text": "<p>See <a href=\"http://codex.wordpress.org/Function_Reference/get_the_ID\" rel=\"nofollow\">http://codex.wordpress.... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9690",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2865/"
] | If possible I want to insert the ID of a post(from a custom post type) into the html of the post itself when its loaded in the viewport.
The scenario is that the content of the custom post type is surrounded by a `<div>`. I want to append an 'id' to the `<div>` that includes the ID of the post. For example if the cust... | Try:
```
<div id="<?php the_title(); ?>-<?php the_ID(); ?>">
```
This should give you a result of:
```
<div id="Post Title-PostID">
```
Giving you a unique wrapper for each post. |
9,708 | <p>I found a plugin called <a href="http://wordpress.org/extend/plugins/multiple-post-thumbnails/" rel="nofollow noreferrer">Multiple Post Thumbnails</a> and followed the directions in getting it set up. Everything shows up correctly in the admin dashboard (i.e. shows two sections to upload two separate thumbnails) but... | [
{
"answer_id": 9802,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 4,
"selected": true,
"text": "<p>Dude, you're doing this the hard way. You can do what you want totally with a single 'featured post thumbnail'. Rea... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9708",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3239/"
] | I found a plugin called [Multiple Post Thumbnails](http://wordpress.org/extend/plugins/multiple-post-thumbnails/) and followed the directions in getting it set up. Everything shows up correctly in the admin dashboard (i.e. shows two sections to upload two separate thumbnails) but after I set the two thumbnails for each... | Dude, you're doing this the hard way. You can do what you want totally with a single 'featured post thumbnail'. Read the documentation about thumbnail sizes in themes. You can inject custom thumbnail sizes in your themes funcitons.php and then give them as a parameter to the (get\_)the\_post\_thumbnail() function. Plea... |
9,710 | <p>I've created a page with a list of posts from a specific category. I would like to enumerate this list like this:</p>
<ul>
<li>lecture 1: post title 1</li>
<li>lecture 2: post title 2</li>
<li>lecture 3: post title 3</li>
<li>etc.</li>
</ul>
<p>How can I do this?</p>
<p>Thanks</p>
| [
{
"answer_id": 9711,
"author": "rexposadas",
"author_id": 413,
"author_profile": "https://wordpress.stackexchange.com/users/413",
"pm_score": 0,
"selected": false,
"text": "<p>Here is what I found in the Codex. Simply replace the category number with the one you are using. I modified it... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9710",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I've created a page with a list of posts from a specific category. I would like to enumerate this list like this:
* lecture 1: post title 1
* lecture 2: post title 2
* lecture 3: post title 3
* etc.
How can I do this?
Thanks | I am not sure what your loop looks like from which you are adding the articles to your list. All you need do is to create a variable to hold your counter somewhere before the while statement in your loop. This could be something like
```
<?php $counter = 0; ?>
```
Note I am setting the counter to 0. Within the while... |
9,713 | <p>I've been using bbPress for a while and I've noticed some bugs in my fresh installs. This makes me wonder if I should consider to just use WordPress with a forum plugin.</p>
<p>Any experience building a bbPress website?</p>
<p>Do you recommend a WordPress plugin to build forums?</p>
| [
{
"answer_id": 9711,
"author": "rexposadas",
"author_id": 413,
"author_profile": "https://wordpress.stackexchange.com/users/413",
"pm_score": 0,
"selected": false,
"text": "<p>Here is what I found in the Codex. Simply replace the category number with the one you are using. I modified it... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9713",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/781/"
] | I've been using bbPress for a while and I've noticed some bugs in my fresh installs. This makes me wonder if I should consider to just use WordPress with a forum plugin.
Any experience building a bbPress website?
Do you recommend a WordPress plugin to build forums? | I am not sure what your loop looks like from which you are adding the articles to your list. All you need do is to create a variable to hold your counter somewhere before the while statement in your loop. This could be something like
```
<?php $counter = 0; ?>
```
Note I am setting the counter to 0. Within the while... |
9,715 | <p>I have created custom post type 'Portfolio' also under this post type I have created Portfolio categories with following code</p>
<p>functions.php - following is the code for custom post type i have defined in functions.php page</p>
<pre><code> function demo_register_post_type() {
register_post_type('P... | [
{
"answer_id": 9720,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 2,
"selected": false,
"text": "<p>to get the posts of your custom post type you need to query post_type and you can do it like so:</p>\n\n<pre><... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9715",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I have created custom post type 'Portfolio' also under this post type I have created Portfolio categories with following code
functions.php - following is the code for custom post type i have defined in functions.php page
```
function demo_register_post_type() {
register_post_type('Portfolio', array(
... | What about using [get\_terms()](http://codex.wordpress.org/Function_Reference/get_terms)?
Quick example:
```
$terms = get_terms('portfolio-category');
foreach ( $terms as $term ) {
echo $term->name.'<br />';
}
``` |
9,716 | <p>I'm trying to retrieve multidimensional values stored in <code>user_meta</code> where the meta key is <code>my_posts</code> and the <code>meta_value</code> is :</p>
<blockquote>
<p>a:3:{i:0;s:2:"23";i:1;s:2:"20";i:2;s:1:"9";}</p>
</blockquote>
<p>Somewhere in the admin page i want to show the sum of the selected... | [
{
"answer_id": 9723,
"author": "Kaaviar",
"author_id": 3071,
"author_profile": "https://wordpress.stackexchange.com/users/3071",
"pm_score": 1,
"selected": false,
"text": "<p>PHP solution:</p>\n\n<pre><code>$tmp = 'a:3:{i:0;s:2:\"23\";i:1;s:2:\"20\";i:2;s:1:\"9\";}';\necho sum_array(unse... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9716",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I'm trying to retrieve multidimensional values stored in `user_meta` where the meta key is `my_posts` and the `meta_value` is :
>
> a:3:{i:0;s:2:"23";i:1;s:2:"20";i:2;s:1:"9";}
>
>
>
Somewhere in the admin page i want to show the sum of the selected posts which are stored in the value above.... | The value is serialized, if you retrieve the meta data with the WordPress functions you'll get that data back unserialized, and you'll be able to iterate over it(looks like an array).
```
$somevar = get_user_meta( '99999', 'your-key', true );
```
As with options in WordPress, user meta is serialized when it's an arr... |
9,729 | <p>I would like to create a shortcode that will extract information for a custom post, and display it within a Page or regular Post. </p>
<p>Specific use case: I have a custom post type "Film" for a film festival website. The films are displayed with their own single-film.php, but occasionally the site owners want to ... | [
{
"answer_id": 9736,
"author": "keatch",
"author_id": 2727,
"author_profile": "https://wordpress.stackexchange.com/users/2727",
"pm_score": 0,
"selected": false,
"text": "<p>Try to start from <a href=\"http://www.smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes/\" rel=\"nof... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9729",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1118/"
] | I would like to create a shortcode that will extract information for a custom post, and display it within a Page or regular Post.
Specific use case: I have a custom post type "Film" for a film festival website. The films are displayed with their own single-film.php, but occasionally the site owners want to write a po... | There are great tutorials about shortcodes all over the web and some good examples [here](https://wordpress.stackexchange.com/questions/1567/best-collection-of-code-for-your-functions-php-file/5741#5741)
but just to get you started:
```
add_shortcode('film_q', 'film_shortcode_query');
function film_shortcode_query($a... |
9,735 | <p>I'm using this same come in two files: <code>single.php</code> and <code>home.php</code>:</p>
<p>(Outside of the loop).</p>
<p>(There is a <code>#mainbar</code> div in both <strong>single posts</strong> and <strong>home page</strong> but the image should be different) </p>
<pre><code><?php // Set and display c... | [
{
"answer_id": 9738,
"author": "scribu",
"author_id": 205,
"author_profile": "https://wordpress.stackexchange.com/users/205",
"pm_score": 1,
"selected": false,
"text": "<p>You are doing something wrong.</p>\n\n<p>First of all, do a <code>var_dump(__FILE__);</code> to make sure you're in ... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9735",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/781/"
] | I'm using this same come in two files: `single.php` and `home.php`:
(Outside of the loop).
(There is a `#mainbar` div in both **single posts** and **home page** but the image should be different)
```
<?php // Set and display custom field
$mainbar_right_title = get_post_meta($post->ID, 'Mainbar Right Title',... | You are doing something wrong.
First of all, do a `var_dump(__FILE__);` to make sure you're in the template you expect.
If that doesn't clear the mist, post the entire template, for context. |
9,741 | <p>This is from the codex:</p>
<pre><code><?php if ( get_post_meta($post->ID, 'thumb', true) ) : ?>
<a href="<?php the_permalink() ?>" rel="bookmark">
<img class="thumb" src="<?php echo get_post_meta($post->ID, 'thumb', true) ?>" alt="<?php the_title(); ?>" />
... | [
{
"answer_id": 9744,
"author": "scribu",
"author_id": 205,
"author_profile": "https://wordpress.stackexchange.com/users/205",
"pm_score": 4,
"selected": true,
"text": "<p><code><?php if ( $mainbar_left_title && $mainbar_left_image ) : ?></code></p>\n\n<p>See <a href=\"http:... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9741",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/781/"
] | This is from the codex:
```
<?php if ( get_post_meta($post->ID, 'thumb', true) ) : ?>
<a href="<?php the_permalink() ?>" rel="bookmark">
<img class="thumb" src="<?php echo get_post_meta($post->ID, 'thumb', true) ?>" alt="<?php the_title(); ?>" />
</a>
<?php endif; ?>
```
I want to include an if state... | `<?php if ( $mainbar_left_title && $mainbar_left_image ) : ?>`
See <http://www.php.net/manual/en/language.operators.logical.php> |
9,752 | <p>I'm trying to display different content depending on the taxonomy that was been selected. For example I have a taxonomy named Type. Inside that taxonomy I have several different children, one is "Photography." I'd like the single of a "Photography" to have a full width instead of it having a sidebar. You can do this... | [
{
"answer_id": 9755,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 3,
"selected": true,
"text": "<p>Try</p>\n\n<pre><code>function has_type( $type, $_post = null ) {\n if ( empty( $type) )\n return fal... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9752",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1388/"
] | I'm trying to display different content depending on the taxonomy that was been selected. For example I have a taxonomy named Type. Inside that taxonomy I have several different children, one is "Photography." I'd like the single of a "Photography" to have a full width instead of it having a sidebar. You can do this in... | Try
```
function has_type( $type, $_post = null ) {
if ( empty( $type) )
return false;
if ( $_post )
$_post = get_post( $_post );
else
$_post =& $GLOBALS['post'];
if ( !$_post )
return false;
$r = is_object_in_term( $_post->ID, 'type', $type);
if ( is_wp_erro... |
9,756 | <p>How to alter the default widget to display a tag cloud of a custom taxonomy?</p>
| [
{
"answer_id": 9759,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 3,
"selected": true,
"text": "<p>Don't know of any but you can easily create your own:</p>\n\n<pre><code><?php \nadd_action(\"widgets_init\",... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9756",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2011/"
] | How to alter the default widget to display a tag cloud of a custom taxonomy? | Don't know of any but you can easily create your own:
```
<?php
add_action("widgets_init", array('Widget_Custom_tax_tag_cloud', 'register'));
class Widget_Custom_tax_tag_cloud {
function control(){
echo 'No control panel';
}
function widget($args){
echo $args['before_widget'];
echo... |
9,771 | <p>Sorry the question might not make sense. I basically have a custom post type called "Projects" and I need to create a way to filter attributes of the project like "name", "type", etc.</p>
<p>For example if I have a project type called airplane, and another project type called airplane. I would want to be able to se... | [
{
"answer_id": 9772,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 0,
"selected": false,
"text": "<p>Simple as this: </p>\n\n<pre><code>// default filter: \napply_filters( 'your_filter_name', $val_to_filter ); \n/... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9771",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3226/"
] | Sorry the question might not make sense. I basically have a custom post type called "Projects" and I need to create a way to filter attributes of the project like "name", "type", etc.
For example if I have a project type called airplane, and another project type called airplane. I would want to be able to search for a... | This is how I did it. If you have your custom post type as "projects", and your category as "airplane".
If you're not planning on using the pre-build loop you would make another one called loop-projects.php. However, it's not necessary.
```
<?php
$args = array(
'num... |
9,774 | <p>The <a href="http://wpengineer.com/2139/adding-settings-to-an-existing-page-using-the-settings-api/" rel="nofollow noreferrer">Settings API</a> is a convenient way to add administrative options. Tutorials on the settings API hook register_setting to admin_init. But what if you also want to programmatically change ... | [
{
"answer_id": 9772,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 0,
"selected": false,
"text": "<p>Simple as this: </p>\n\n<pre><code>// default filter: \napply_filters( 'your_filter_name', $val_to_filter ); \n/... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9774",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3202/"
] | The [Settings API](http://wpengineer.com/2139/adding-settings-to-an-existing-page-using-the-settings-api/) is a convenient way to add administrative options. Tutorials on the settings API hook register\_setting to admin\_init. But what if you also want to programmatically change the same options outside of the Settings... | This is how I did it. If you have your custom post type as "projects", and your category as "airplane".
If you're not planning on using the pre-build loop you would make another one called loop-projects.php. However, it's not necessary.
```
<?php
$args = array(
'num... |
9,776 | <p>I'm trying to create a filter using two meta_values.</p>
<p>Example.
If the current page has meta values red and blue, only display queried pages that have both red and blue and none that have just red or just blue.</p>
<p>I thought this could be accomplished with two meta values <code>'meta_value' => $red, $bl... | [
{
"answer_id": 9801,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 0,
"selected": false,
"text": "<p>I think this should work if you wrap it in an array? Not entirely sure, though ... 'meta_value' => array('red', 'b... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9776",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3296/"
] | I'm trying to create a filter using two meta\_values.
Example.
If the current page has meta values red and blue, only display queried pages that have both red and blue and none that have just red or just blue.
I thought this could be accomplished with two meta values `'meta_value' => $red, $blue` but apparently it's ... | 'meta\_query' is what you're looking for:
<http://scribu.net/wordpress/advanced-metadata-queries.html> |
9,781 | <p>I would like to make it so the URLs of my pages (created in the Wordpress dashboard) show up right after the domain name instead of after the blog directory. </p>
<p>I have installed Wordpress in a directory called <strong>blog</strong> which is located in the <strong>public_html</strong> directory. When I make a <... | [
{
"answer_id": 9787,
"author": "gesher",
"author_id": 3271,
"author_profile": "https://wordpress.stackexchange.com/users/3271",
"pm_score": 1,
"selected": false,
"text": "<p>The easiest way is just to install WordPress in the root directory instead of in the subdirectory /blog/. </p>\n\n... | 2011/02/18 | [
"https://wordpress.stackexchange.com/questions/9781",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I would like to make it so the URLs of my pages (created in the Wordpress dashboard) show up right after the domain name instead of after the blog directory.
I have installed Wordpress in a directory called **blog** which is located in the **public\_html** directory. When I make a *page* from the Wordpress dashboard ... | You just set the WordPress directory in your WP General Settings to your top-level URL (www.site.com/), then copy index.php to the root directory of your site and modify it to load content from your actual wp directory.
Step by step instructions are here: <http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory>... |
9,805 | <p>I am aware of creating a shortcode this way:</p>
<pre><code>function font_fam($atts, $content = null){
extract(shortcode_atts(array(
'f' => '',
), $atts ));
return '<span style="font-family:'.$f.'">'.$content.'</span>';
}
add_shortcode ('f','font_fam');
</code></pre>
<p>And to use it would ... | [
{
"answer_id": 9806,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 1,
"selected": false,
"text": "<p>One way could be to preparse your content by hooking a 'the_content' filter that adds the <code>f=</code> bit.</p>... | 2011/02/19 | [
"https://wordpress.stackexchange.com/questions/9805",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3305/"
] | I am aware of creating a shortcode this way:
```
function font_fam($atts, $content = null){
extract(shortcode_atts(array(
'f' => '',
), $atts ));
return '<span style="font-family:'.$f.'">'.$content.'</span>';
}
add_shortcode ('f','font_fam');
```
And to use it would be like this right:
```
[f f="Arial"] Te... | Try this:
```
function font_fam($atts, $content = null) {
extract(shortcode_atts(array(
'f' => isset($atts[0]) ? $atts[0] : '' ,
), $atts));
return '<span style="font-family:' . $f . '">' . $content . '</span>';
}
add_shortcode ('f','font_fam');
``` |
9,834 | <p>I am not sure why but I have used <code>get_posts()</code> to query for some data. Then I used <code>setup_postdata()</code> ... I think its used so that I can use functions like <code>the_permalink()</code> etc with the new post data? </p>
<pre><code><?php foreach ($childPosts as $cp) : setup_postdata($cp); ?&g... | [
{
"answer_id": 9836,
"author": "curtismchale",
"author_id": 141,
"author_profile": "https://wordpress.stackexchange.com/users/141",
"pm_score": 1,
"selected": false,
"text": "<p>When querying posts just use the normal loop with a set of arguments passed into it. Then reset the query at t... | 2011/02/19 | [
"https://wordpress.stackexchange.com/questions/9834",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/794/"
] | I am not sure why but I have used `get_posts()` to query for some data. Then I used `setup_postdata()` ... I think its used so that I can use functions like `the_permalink()` etc with the new post data?
```
<?php foreach ($childPosts as $cp) : setup_postdata($cp); ?>
<article <?php post_class() ?> id="post-<?php the... | I could be wrong, but from what I'm seeing, "setup\_postdata()" should be used when doing a custom select query (not just query\_posts):
<http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query>
As well, if you want to use tags like "the\_title()" and "the\_permalink()" with that custom select query ..... |
9,838 | <p>Problem: Add a hook that automatically adds a <strong>short tag</strong> to video attachments
when inserted from the Media Library (video) tab:</p>
<p><strong>Update:</strong></p>
<p>This works under the 'Media Library' tab — and doesn't break image inserts etc.:</p>
<pre><code>add_filter('media_send_to_editor', ... | [
{
"answer_id": 9843,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 4,
"selected": true,
"text": "<p>There's a <code>get_image_send_to_editor()</code> function in wp-admin/includes/media.php that runs this: <code>app... | 2011/02/19 | [
"https://wordpress.stackexchange.com/questions/9838",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3292/"
] | Problem: Add a hook that automatically adds a **short tag** to video attachments
when inserted from the Media Library (video) tab:
**Update:**
This works under the 'Media Library' tab — and doesn't break image inserts etc.:
```
add_filter('media_send_to_editor', 'my_filter_iste', 20, 3);
function my_filter_iste($ht... | There's a `get_image_send_to_editor()` function in wp-admin/includes/media.php that runs this: `apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt );`. Try hooking that filter.
Edit: Help with the filter call...
Your call to hook the callback would look like this:
```
add_... |
9,859 | <p>I've created archive pages for all my taxonomies (<code>taxonomie-{taxonomy-name}.php</code>) and this works fine. The slug of my taxonomies are the same as the slug of it's <code>post-type</code>. This makes it possible to create neat hierarchy in the URL, for example:</p>
<p>When post-type <code>products</code> h... | [
{
"answer_id": 9880,
"author": "mfields",
"author_id": 11019,
"author_profile": "https://wordpress.stackexchange.com/users/11019",
"pm_score": 0,
"selected": false,
"text": "<p>If I am understanding you correctly, then you have a taxonomy named \"type\" defined on your site. This will br... | 2011/02/19 | [
"https://wordpress.stackexchange.com/questions/9859",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3323/"
] | I've created archive pages for all my taxonomies (`taxonomie-{taxonomy-name}.php`) and this works fine. The slug of my taxonomies are the same as the slug of it's `post-type`. This makes it possible to create neat hierarchy in the URL, for example:
When post-type `products` has 'type' as a taxonomy with the values boo... | Figured it out myself. Apparently, the pagination break because both my 'products' and my 'types' (those are not the terms I have, just for demonstration purposes) are having the same slug. Products has a slug of 'products' and types has a slug of 'products/%typename%'. Due to this I can make my permalinks hierarchical... |
9,869 | <p>I'm calling the function below after each "save changes" on my plugin's settings file via the sanitization callback.</p>
<p>The plugin allows the end user to change their category base, and needs to completely rewrite the permalinks in order to avoid 404 errors. However, I'm still getting 404s. The only way I can r... | [
{
"answer_id": 9875,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 1,
"selected": true,
"text": "<p>Check the code in wp-admin/options-permalink.php lines 91 to 129 (3.0.5). Compare if you do all that.</p>\n"
},
... | 2011/02/20 | [
"https://wordpress.stackexchange.com/questions/9869",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/366/"
] | I'm calling the function below after each "save changes" on my plugin's settings file via the sanitization callback.
The plugin allows the end user to change their category base, and needs to completely rewrite the permalinks in order to avoid 404 errors. However, I'm still getting 404s. The only way I can resolve the... | Check the code in wp-admin/options-permalink.php lines 91 to 129 (3.0.5). Compare if you do all that. |
9,870 | <p>I'm trying to create a custom API endpoint in WordPress, and I need to redirect requests to a virtual page in the root of WordPress to an actual page that ships with my plug-in. So basically, all requests to the one page are actually routed to the other.</p>
<p>Example:<br>
<code>http://mysite.com/my-api.php</code... | [
{
"answer_id": 9871,
"author": "Will Anderson",
"author_id": 3329,
"author_profile": "https://wordpress.stackexchange.com/users/3329",
"pm_score": 4,
"selected": false,
"text": "<p>Any reason not to do something like this instead?</p>\n\n<p><a href=\"http://mysite.com/?my-api=1\">http://... | 2011/02/20 | [
"https://wordpress.stackexchange.com/questions/9870",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/46/"
] | I'm trying to create a custom API endpoint in WordPress, and I need to redirect requests to a virtual page in the root of WordPress to an actual page that ships with my plug-in. So basically, all requests to the one page are actually routed to the other.
Example:
`http://mysite.com/my-api.php` => `http://mysite.com... | There are two types of rewrite rules in WordPress: internal rules (stored in the database and parsed by [WP::parse\_request()](http://core.trac.wordpress.org/browser/tags/3.0.5/wp-includes/classes.php#L121)), and external rules (stored in `.htaccess` and parsed by Apache). You can choose either way, depending on how mu... |
9,878 | <p>I'm currently using the following bit of code to display related posts on my single template.</p>
<pre><code> <?php
$orig_post = $post;
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_t... | [
{
"answer_id": 9882,
"author": "rexposadas",
"author_id": 413,
"author_profile": "https://wordpress.stackexchange.com/users/413",
"pm_score": 0,
"selected": false,
"text": "<p>I couldn't find a way to filter via post type when retrieving a list of tags. \nI would do something like this: ... | 2011/02/20 | [
"https://wordpress.stackexchange.com/questions/9878",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3239/"
] | I'm currently using the following bit of code to display related posts on my single template.
```
<?php
$orig_post = $post;
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $in... | Something exactly like `'post_type' => 'videos'` somewhere in your `$args` array :) |
9,901 | <p>I'd like to hide certain menus like Media, Privacy, and Permalinks. I've been using the following code to hide entire parent menus but not sure how to go about for submenus.</p>
<pre><code>function remove_menus () {
global $menu;
$restricted = array(__('Links'), __('Comments'), __('Appearance'), __('Tools')... | [
{
"answer_id": 9904,
"author": "Dwayne Charrington",
"author_id": 1687,
"author_profile": "https://wordpress.stackexchange.com/users/1687",
"pm_score": 1,
"selected": false,
"text": "<p>There is a plugin for that, it's called: Admin Menu Editor and you can download it here - <a href=\"ht... | 2011/02/20 | [
"https://wordpress.stackexchange.com/questions/9901",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3239/"
] | I'd like to hide certain menus like Media, Privacy, and Permalinks. I've been using the following code to hide entire parent menus but not sure how to go about for submenus.
```
function remove_menus () {
global $menu;
$restricted = array(__('Links'), __('Comments'), __('Appearance'), __('Tools'));
end... | If you would like to code it yourself, here is a good tutorial for customizing the Admin Menu. <http://sixrevisions.com/wordpress/how-to-customize-the-wordpress-admin-area/>
Copying from the tutorial, they remove the Editor sublink:
```
function remove_editor_menu() {
remove_action('admin_menu', '_add_themes_util... |
9,903 | <p>Ok, I'm developing my own widget and I've a HUGE problem.</p>
<p>I don't know how to fetch and eventually save html selects value.</p>
<p>Simple example:</p>
<pre><code>/* initialize TITLE */
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', $instance['... | [
{
"answer_id": 9954,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 4,
"selected": true,
"text": "<p>See my comment above...you're using <code>get_field_id()</code> on the name-attribute, where it should be <code>get... | 2011/02/20 | [
"https://wordpress.stackexchange.com/questions/9903",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1869/"
] | Ok, I'm developing my own widget and I've a HUGE problem.
I don't know how to fetch and eventually save html selects value.
Simple example:
```
/* initialize TITLE */
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', $instance['title'] );
(...)
/* update... | See my comment above...you're using `get_field_id()` on the name-attribute, where it should be `get_field_name()`.
`get_field_id()` returns `'widget-'.$this->id_base.'-'.$this->number.'-'.$field_name`,
whereas
`get_field_name()` returns `'widget-'.$this->id_base.'[' . $this->number . '][' . $field_name.']'` |
9,915 | <p>I have a Roster page which contains two sections. The first section contains the artist with their pictures, short bios, and website links; and the second section contains the combined videos of every artist in the roster.</p>
<p>Similar to this:</p>
<p><img src="https://i.stack.imgur.com/X9tER.jpg" alt="roster"><... | [
{
"answer_id": 9917,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 0,
"selected": false,
"text": "<p>Don't quite know if i get you right, but you could make one hierarchical post type and then diversify either by le... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/9915",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3239/"
] | I have a Roster page which contains two sections. The first section contains the artist with their pictures, short bios, and website links; and the second section contains the combined videos of every artist in the roster.
Similar to this:

Normally, I'd create two separ... | It would take some custom coding, but there is a way to keep both custom post types and link the artist and video post types together. It involves using the post\_parent property of a post to make them hierarchical without combining the two.
I'm currently using the following code to attach one post type to another:
... |
9,916 | <p>I am trying to create this plugin for my site that will allow create short codes to pull data from the iTunes Search SDK. I already have the iTunes Search SDK javascript plugin working that pulls the data from the search SDK but I am running into an issue with placing the required javascript into the shortcode.</p>... | [
{
"answer_id": 9925,
"author": "onetrickpony",
"author_id": 1986,
"author_profile": "https://wordpress.stackexchange.com/users/1986",
"pm_score": 1,
"selected": false,
"text": "<p>I'm guessing it's because you didn't escape the single quotes. Try using output buffering, the code is more ... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/9916",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1516/"
] | I am trying to create this plugin for my site that will allow create short codes to pull data from the iTunes Search SDK. I already have the iTunes Search SDK javascript plugin working that pulls the data from the search SDK but I am running into an issue with placing the required javascript into the shortcode.
The co... | jQuery is running in [compatibility mode](http://docs.jquery.com/Using_jQuery_with_Other_Libraries) in WP. Instead of …
```
$(document).ready(function() {}
```
… use …
```
jQuery(document).ready(function($) {}
``` |
9,919 | <p>I am trying to create a totally different profile page (not the one provided by Wordpress), since the layout and feel of the default profile page is too "Wordpress" for the users. Now I am successful in being able to present a page that can modify user meta data like firstname, lastname, city, zip code, etc.</p>
<p... | [
{
"answer_id": 9920,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 4,
"selected": false,
"text": "<p>A simple <code>wp_update_user(array('ID' => $userid, 'user_pass' => 'myNeWpaSSword'))</code> will do everyth... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/9919",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2630/"
] | I am trying to create a totally different profile page (not the one provided by Wordpress), since the layout and feel of the default profile page is too "Wordpress" for the users. Now I am successful in being able to present a page that can modify user meta data like firstname, lastname, city, zip code, etc.
Now what ... | ```
wp_set_password( $password, $user_id );
```
See [reference](http://queryposts.com/function/wp_set_password/) for details. |
9,929 | <p>I saw some other similar threads but they were all for YouTube videos. I was wondering if the same could be done for videos hosted on other servers like blip. Here is an example of a blip video: <a href="http://blip.tv/file/4778330" rel="nofollow">http://blip.tv/file/4778330</a></p>
<p>This is how I currently have ... | [
{
"answer_id": 9932,
"author": "Scott Elkin",
"author_id": 759,
"author_profile": "https://wordpress.stackexchange.com/users/759",
"pm_score": 0,
"selected": false,
"text": "<p>It would seem that the thumbnail blip creates for each video isn't like youtube, where you can use the videoid ... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/9929",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3239/"
] | I saw some other similar threads but they were all for YouTube videos. I was wondering if the same could be done for videos hosted on other servers like blip. Here is an example of a blip video: <http://blip.tv/file/4778330>
This is how I currently have things set up:
I have a custom post type for Videos with a meta ... | You can use the Blip TV API:
<http://wiki.blip.tv/index.php/Blip.tv_API>
Look for "How do I find the thumbnail for an item?"
Examples of the API can be found in the wiki e.g. the PHP Example:
```
include_once("blipPHP.php");
$blipPHP = new blipPHP("username", "password");
$respond = $blipPHP->info(4794325);
```
re... |
9,961 | <p>I know this question is asked many times on stack-exchange, but I am with something new</p>
<p>I want to have three Drop Down Boxes and a search button, the drop-down boxes will contain terms of 3 custom taxonomies, when I will select three values in it and hit search, I will get results which will be having these ... | [
{
"answer_id": 9976,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 2,
"selected": true,
"text": "<p>Wordpress in version prior to 3.1 does not support querying multiple taxonomies, you will need to install Scrib... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/9961",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1743/"
] | I know this question is asked many times on stack-exchange, but I am with something new
I want to have three Drop Down Boxes and a search button, the drop-down boxes will contain terms of 3 custom taxonomies, when I will select three values in it and hit search, I will get results which will be having these three term... | Wordpress in version prior to 3.1 does not support querying multiple taxonomies, you will need to install Scribu's plugin [Query Multiple Taxonomies](http://wordpress.org/extend/plugins/query-multiple-taxonomies/) to fix that.
and in order to get the dropdown select box you can use `wp_dropdown_categories()`
like this:... |
9,968 | <p>Do I do this exactly the same way as I would with normal posts? I use a $featured_cat global variable and pull that out. Should I do the same here?</p>
<p>Or should I use an associated custom taxonomy? Or perhaps I am over-thinking it? Would there really be a benefit with taxonomies?</p>
<p><em>What's the right ap... | [
{
"answer_id": 9974,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 0,
"selected": false,
"text": "<p>Same as with every other post type, really...use a category...or whatever other method you prefer (tag, custom tax... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/9968",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3361/"
] | Do I do this exactly the same way as I would with normal posts? I use a $featured\_cat global variable and pull that out. Should I do the same here?
Or should I use an associated custom taxonomy? Or perhaps I am over-thinking it? Would there really be a benefit with taxonomies?
*What's the right approach here, guys?* | Register a video post type and a ~~"Featured Taxonomy"~~ "Featured Custom Meta Select Box
-----------------------------------------------------------------------------------------
### The Post type:
```
function c3m_reg_vid_post() {
$labels = array(
'name' => _x('Videos', 'post type gen... |
9,978 | <p>Could someone please explain to me how this function works? I know what it does but when I look at the source code in the twenty_ten template, I don't get how all loops are being collected in one single loop.php ( I saw that file too).</p>
<p>So how do for instance abstract away a certain common part of template an... | [
{
"answer_id": 9981,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 3,
"selected": false,
"text": "<p>Not all loops, the main loop. ;-) No matter if you look at your frontpage or a category or whoknowswhat, you'll al... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/9978",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3361/"
] | Could someone please explain to me how this function works? I know what it does but when I look at the source code in the twenty\_ten template, I don't get how all loops are being collected in one single loop.php ( I saw that file too).
So how do for instance abstract away a certain common part of template and then re... | Some very good introductory answers here.
Basically, `get_template_part()` allows theme developers to set up an order of specificity of template files. Think of it similarly to specificity as it applies to CSS selectors. When designing something, you want to start with the bare minimum of specificity, so that it can b... |
9,979 | <p>Is there an easy way to ensure that external feeds (via <code>fetch_feed()</code>) are only fetched via cron, and not when a regular user visits the site? This is for performance reasons, I want to minimize the page load time.</p>
<p>The only time a feed should load in a normal request are probably when the cache i... | [
{
"answer_id": 10343,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 2,
"selected": false,
"text": "<p>My recommendation would be to set up a wrapper for <code>fetch_feed()</code>. Call the wrapper function through Word... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/9979",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8/"
] | Is there an easy way to ensure that external feeds (via `fetch_feed()`) are only fetched via cron, and not when a regular user visits the site? This is for performance reasons, I want to minimize the page load time.
The only time a feed should load in a normal request are probably when the cache is empty (the first ti... | My recommendation would be to set up a wrapper for `fetch_feed()`. Call the wrapper function through WordPress' cron and you shouldn't have an issue.
So something like:
```
function schedule_fetch_feeds() {
if ( ! wp_next_scheduled( 'cron_fetch' ) ) {
wp_schedule_event( time(), 'hourly', 'cron_fetch', 'ht... |
9,989 | <p>I got the problem that i have to load my parent theme's <code>functions.php</code> file before my child theme's <code>functions.php</code> file loads. This is needed for the setup & init procedure. I looked at the hooks inside /wp_core_root/wp-settings.php (named: <code>do_action('setup_theme');</code>). </p>
<... | [
{
"answer_id": 10001,
"author": "Otto",
"author_id": 2232,
"author_profile": "https://wordpress.stackexchange.com/users/2232",
"pm_score": 3,
"selected": false,
"text": "<p>Firstly, you can't. The child theme's functions.php always loads first, period. </p>\n\n<p>Second, themes can't hoo... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/9989",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/385/"
] | I got the problem that i have to load my parent theme's `functions.php` file before my child theme's `functions.php` file loads. This is needed for the setup & init procedure. I looked at the hooks inside /wp\_core\_root/wp-settings.php (named: `do_action('setup_theme');`).
The problem is that i don't know how to hoo... | Justin Tadlock recently wrote a great post about **making a better functions.php file**
where (if I remember correctly) he deals with this exact issue.
Unfortunately his site is down at the moment so I have to rely on my memory for now.
You are on the right track with the `after_setup_theme` hook.
1. As far as I... |
10,015 | <p>Trying to display a category by an odd sequence and have the following: </p>
<pre><code><?php wp_list_categories('orderby=id&include=4,5,6,7,8,9,10,72,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41'); ?>
</code></pre>
<p>notice after ID #10 it jumps to ID #72... | [
{
"answer_id": 10017,
"author": "leeo",
"author_id": 3377,
"author_profile": "https://wordpress.stackexchange.com/users/3377",
"pm_score": 0,
"selected": false,
"text": "<p>I've not used it, but you may be interested in the <a href=\"http://wordpress.org/extend/plugins/my-category-order/... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10015",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | Trying to display a category by an odd sequence and have the following:
```
<?php wp_list_categories('orderby=id&include=4,5,6,7,8,9,10,72,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41'); ?>
```
notice after ID #10 it jumps to ID #72. How can I code this better?
Note:... | You could do something like this:
```
<ul>
<?php
wp_list_categories('order_by=ID&title_li=&include=4,5,6,7,8,9,10');
wp_list_categories('order_by=ID&title_li=$include=72');
wp_list_categories('order_by=ID&title_li=&include=11,12,13,14,15,16,17, 18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41');... |
10,029 | <p>I created a new taxonomy called 'country' and have two terms items inside it: 'USA' and 'Canada'. How do I go about querying this info? I have a filter page with two checkboxes:</p>
<pre><code><input type="checkbox" name="usa" value="USA" /> USA
<input type="checkbox" name="canada" value="Canada" /> Can... | [
{
"answer_id": 10031,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>You’ll have to clarify your query, but these might also be helpful:</p>\n\n<p><strong>the_terms</strong> Displays ... | 2011/02/21 | [
"https://wordpress.stackexchange.com/questions/10029",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5875/"
] | I created a new taxonomy called 'country' and have two terms items inside it: 'USA' and 'Canada'. How do I go about querying this info? I have a filter page with two checkboxes:
```
<input type="checkbox" name="usa" value="USA" /> USA
<input type="checkbox" name="canada" value="Canada" /> Canada
```
How do I make th... | You'll want to use the `tax_query` argument for query\_posts/WP\_Query.
```
query_posts( array(
"tax_query" => array(
array(
"taxonomy" => "country",
"field" => "slug",
"terms" => array( "usa", "canada" )
)
)
) );
```
The `tax_query` argument is an array, so you can query multiple taxon... |
10,032 | <p>Does anybody have an idea how to add testimonials with an image in WordPress? Is there is any plugin that fulfills my requirement? I searched but did not find any. It must support PHP version 4.4.9.</p>
| [
{
"answer_id": 10033,
"author": "Vlad.P",
"author_id": 1882,
"author_profile": "https://wordpress.stackexchange.com/users/1882",
"pm_score": 1,
"selected": false,
"text": "<p>Make a new category called <strong>Testimonials</strong> then, in your theme folder add a new file called <strong... | 2010/12/01 | [
"https://wordpress.stackexchange.com/questions/10032",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1850/"
] | Does anybody have an idea how to add testimonials with an image in WordPress? Is there is any plugin that fulfills my requirement? I searched but did not find any. It must support PHP version 4.4.9. | Make a new category called **Testimonials** then, in your theme folder add a new file called **testimonials.php**.
Add this in the newly created file:
```
<div id="testimonials">
<?php $args = array('caller_get_posts' => 1, 'post_type' => 'testimonials', 'post_status' => 'publish', 'posts_per_page' => 5);
que... |
10,038 | <p>I am trying to style a table in a Wordpress post, but am having difficulty getting it to work. I have set the post to HTML-editing mode and can get some of the styles to take, but not all. (To be honest, this is not the first time I have had trouble getting table styles to work.) The contents of the post (using cont... | [
{
"answer_id": 10046,
"author": "Tafts",
"author_id": 3181,
"author_profile": "https://wordpress.stackexchange.com/users/3181",
"pm_score": 3,
"selected": true,
"text": "<p>If you search for plugins at <a href=\"http://wordpress.org/extend/plugins/\" rel=\"nofollow\">http://wordpress.org... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10038",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/121/"
] | I am trying to style a table in a Wordpress post, but am having difficulty getting it to work. I have set the post to HTML-editing mode and can get some of the styles to take, but not all. (To be honest, this is not the first time I have had trouble getting table styles to work.) The contents of the post (using contriv... | If you search for plugins at <http://wordpress.org/extend/plugins/> rather than through your WordPress install you get more options on your search results. |
10,072 | <p>I've found almost the same question: <a href="https://stackoverflow.com/questions/4796165/multiple-loops-in-wordpress-second-loop-not-resetting">https://stackoverflow.com/questions/4796165/multiple-loops-in-wordpress-second-loop-not-resetting</a> but the answer doesn't work for me.</p>
<p>I have "portfolio" post ty... | [
{
"answer_id": 10074,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 2,
"selected": true,
"text": "<p>It sounds like your widget references the global $loop for some reason. This could possibly be due to the internal... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10072",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1869/"
] | I've found almost the same question: <https://stackoverflow.com/questions/4796165/multiple-loops-in-wordpress-second-loop-not-resetting> but the answer doesn't work for me.
I have "portfolio" post type, and I'm working on widget displaying all portfolio items.
This code works perfectly on page-portfolio:
```
$loop =... | It sounds like your widget references the global $loop for some reason. This could possibly be due to the internals of the Widget class or due to interference of other plugins, i guess.
As a first step, to be on the safe side, try using a different variable name. The global loop is referred to as $loop, by simply rena... |
10,073 | <p>I'm trying to make a very simple widget that access tables contained within the same database instance as my Wordpress database, but are not wordpress tables. I'm using the <a href="http://codex.wordpress.org/Function_Reference/wpdb_Class" rel="nofollow">wpdb class according to the codex</a>. I'm not getting any err... | [
{
"answer_id": 10076,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/wpdb_Class#SELECT_Generic_Results\" rel=\"nofollow\"><code>$... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10073",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3397/"
] | I'm trying to make a very simple widget that access tables contained within the same database instance as my Wordpress database, but are not wordpress tables. I'm using the [wpdb class according to the codex](http://codex.wordpress.org/Function_Reference/wpdb_Class). I'm not getting any errors, but I'm also not getting... | If you really just want a single row, use `$wpdb->get_row($sql)` instead.
But your query looks funny...it looks like you're trying to get the latest 'client status' for the user in which case your query should be:
`'SELECT status FROM Clients WHERE UserID = '.$current_user->ID.' ORDER BY ID DESC LIMIT 1'`.
And if ... |
10,085 | <p>i've got several posts which are tagged with "design", but also a page called "design".</p>
<p>my question:
i put some text into the design-page and would then display all posts which are tagged by "design". how is that possible? can i put a placeholder directly into the text or do i have to code it by myself in ph... | [
{
"answer_id": 10086,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 1,
"selected": false,
"text": "<p>Easiest way would be to turn your 'Design' tag into a 'Design' Category and then use the Category archive page as... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10085",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3030/"
] | i've got several posts which are tagged with "design", but also a page called "design".
my question:
i put some text into the design-page and would then display all posts which are tagged by "design". how is that possible? can i put a placeholder directly into the text or do i have to code it by myself in php?
thx | You could easily modify the page template of your theme to include a section that reads "Related Posts" at the bottom and then execute a simple PHP query to get posts as follows:
```
<?php query_posts('category_name=wordpress&showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<li>
<a href="<?php th... |
10,088 | <p>I make a GET call to API, call is supposed to return no data:</p>
<ul>
<li>browser (and sniffer) give me 200-OK response with <code>null</code> text as body;</li>
<li><code>wp_remote_get()</code> gives me 200-OK response with string of <strong>binary garbage</strong> as body.</li>
</ul>
<p>Other API requests (that... | [
{
"answer_id": 10086,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 1,
"selected": false,
"text": "<p>Easiest way would be to turn your 'Design' tag into a 'Design' Category and then use the Category archive page as... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10088",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/847/"
] | I make a GET call to API, call is supposed to return no data:
* browser (and sniffer) give me 200-OK response with `null` text as body;
* `wp_remote_get()` gives me 200-OK response with string of **binary garbage** as body.
Other API requests (that are supposed to and do return non-empty data) work perfectly fine.
W... | You could easily modify the page template of your theme to include a section that reads "Related Posts" at the bottom and then execute a simple PHP query to get posts as follows:
```
<?php query_posts('category_name=wordpress&showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<li>
<a href="<?php th... |
10,109 | <p>I have a single-posttype.php and I'm trying to figure out how to display the image</p>
| [
{
"answer_id": 10111,
"author": "t31os",
"author_id": 31073,
"author_profile": "https://wordpress.stackexchange.com/users/31073",
"pm_score": 3,
"selected": true,
"text": "<p>Everything you need can be found on the Codex documentation page for post thumbnails.<br>\n<a href=\"http://codex... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10109",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3226/"
] | I have a single-posttype.php and I'm trying to figure out how to display the image | Everything you need can be found on the Codex documentation page for post thumbnails.
<http://codex.wordpress.org/Post_Thumbnails>
Specifically i think you're looking for..
```
<?php the_post_thumbnail(); ?>
``` |
10,112 | <p>Whilst performing wp_insert_post, how would one insert the post thumbnail. I tried the code below to no avail.</p>
<pre><code>$postit = array(
'post_title' => $itemtitle,
'post_content' => '',
'post_status' => 'publish',
'post_type' => 'items',
'post_author' => $user_ID,
'tags... | [
{
"answer_id": 10114,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 1,
"selected": false,
"text": "<p>you need to first create the post and get the id:</p>\n\n<pre><code>$postit = array(\n 'post_title' => ... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10112",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2957/"
] | Whilst performing wp\_insert\_post, how would one insert the post thumbnail. I tried the code below to no avail.
```
$postit = array(
'post_title' => $itemtitle,
'post_content' => '',
'post_status' => 'publish',
'post_type' => 'items',
'post_author' => $user_ID,
'tags_input' => $the_post_id,
... | you need to first create the post and get the id:
```
$postit = array(
'post_title' => $itemtitle,
'post_content' => '',
'post_status' => 'publish',
'post_type' => 'items',
'post_author' => $user_ID,
'tags_input' => $the_post_id
);
$the_post_idit = wp_insert_post( $postit);
```
Once you ha... |
10,118 | <p>I know you can add a class in the custom menu options, but it adds it to the LI before the A. I want to apply the class directly to this specific A rather then the whole LI.</p>
<p>So instead of the output being</p>
<pre><code><li id="menu-item-51" class="NEWCLASS menu-item menu-item-type-custom menu-item-51"&g... | [
{
"answer_id": 10125,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 4,
"selected": false,
"text": "<p>you can use <code>nav_menu_css_class</code> filter </p>\n\n<pre><code>add_filter('nav_menu_css_class' , 'my_n... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10118",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I know you can add a class in the custom menu options, but it adds it to the LI before the A. I want to apply the class directly to this specific A rather then the whole LI.
So instead of the output being
```
<li id="menu-item-51" class="NEWCLASS menu-item menu-item-type-custom menu-item-51"><a href="#">Link</a> </li... | you can use `nav_menu_css_class` filter
```
add_filter('nav_menu_css_class' , 'my_nav_special_class' , 10 , 2);
function my_nav_special_class($classes, $item){
if(your condition){ //example: you can check value of $item to decide something...
$classes[] = 'my_class';
}
return $classes;
}
```
Usi... |
10,119 | <p>Why doesnt this work ? I am trying to selectively load scripts but the second if statement is not loading them where it should.</p>
<pre><code>function my_init() {
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.... | [
{
"answer_id": 10125,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 4,
"selected": false,
"text": "<p>you can use <code>nav_menu_css_class</code> filter </p>\n\n<pre><code>add_filter('nav_menu_css_class' , 'my_n... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10119",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2661/"
] | Why doesnt this work ? I am trying to selectively load scripts but the second if statement is not loading them where it should.
```
function my_init() {
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js... | you can use `nav_menu_css_class` filter
```
add_filter('nav_menu_css_class' , 'my_nav_special_class' , 10 , 2);
function my_nav_special_class($classes, $item){
if(your condition){ //example: you can check value of $item to decide something...
$classes[] = 'my_class';
}
return $classes;
}
```
Usi... |
10,138 | <p>In my web pages I want to use relative links instead of absolute links.</p>
<p>However, pages do not allow php code inside them, so i cannot do to from a url in a relative manner.</p>
<p>How does one get relative urls inside wordpress pages so that changing domain names wouldnt affect the links?</p>
| [
{
"answer_id": 10144,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 2,
"selected": false,
"text": "<p>two ways to do that:</p>\n\n<ul>\n<li><p><a href=\"http://codex.wordpress.org/Linking_Posts_Pages_and_Categor... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10138",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3408/"
] | In my web pages I want to use relative links instead of absolute links.
However, pages do not allow php code inside them, so i cannot do to from a url in a relative manner.
How does one get relative urls inside wordpress pages so that changing domain names wouldnt affect the links? | ```
$my_url = 'my/relative/url.php';
echo site_url($my_url);
```
[site\_url()](http://codex.wordpress.org/Function_Reference/site_url) when used by itself will return the absolute path to your blog. But, if you add an argument to it, as per my example above, it will prepend the absolute path to your path. Just make s... |
10,140 | <p>I created a function to save custom fields on publish a post. Something like this. </p>
<pre><code>function create_fields() {
global $post;
$casa_id = $post->ID;
update_post_meta($post->ID, 'casa_id', $casa_id);
}
add_action('publish_post', 'create_fields');
</code></pre>
<p>This ... | [
{
"answer_id": 10143,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 2,
"selected": false,
"text": "<p>you can do something like this:</p>\n\n<pre><code>$args = array(\n 'posts_per_page' => 1000,\n 'post... | 2011/02/22 | [
"https://wordpress.stackexchange.com/questions/10140",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/433/"
] | I created a function to save custom fields on publish a post. Something like this.
```
function create_fields() {
global $post;
$casa_id = $post->ID;
update_post_meta($post->ID, 'casa_id', $casa_id);
}
add_action('publish_post', 'create_fields');
```
This function saves on a custom field ... | you can do something like this:
```
$args = array(
'posts_per_page' => 1000,
'post_type' => 'post'
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
$casa_id = $post->ID;
update_post_meta($post... |
10,149 | <p>I am using the <a href="http://wordpress.org/extend/plugins/media-library-categories/" rel="nofollow">Media Library Categories</a> plugin. It does not have much documentation, so I have concluded the way to implement it would be using the shortcode <code>[mediacategories categories="6"]</code>.</p>
<p>I want to imp... | [
{
"answer_id": 10159,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 3,
"selected": true,
"text": "<p><code>do_shortcode()</code> just parses the string. You have to use <code>echo</code> or <code>print</code> to print it... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10149",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1878/"
] | I am using the [Media Library Categories](http://wordpress.org/extend/plugins/media-library-categories/) plugin. It does not have much documentation, so I have concluded the way to implement it would be using the shortcode `[mediacategories categories="6"]`.
I want to implement this directly into the theme template. S... | `do_shortcode()` just parses the string. You have to use `echo` or `print` to print it out.
`function_exists()` expects a string that matches a function name. After looking at the plugin, I would try this code:
```
<?php
if ( function_exists( 'mediacategories_func' ) )
{
?>
<h1>Inspiration</h1>
<?php
print mediac... |
10,154 | <p>I want to move login page physically (not virtually). Please, suggest a plugin way to do this which could alter core codes on fly (even after core code update). It can be another layer of security.</p>
| [
{
"answer_id": 10156,
"author": "konus",
"author_id": 3414,
"author_profile": "https://wordpress.stackexchange.com/users/3414",
"pm_score": 0,
"selected": false,
"text": "<p>You could try editing the <code>.htaccess</code> and perform a redirect to another path of your convenience. </p>\... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10154",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3411/"
] | I want to move login page physically (not virtually). Please, suggest a plugin way to do this which could alter core codes on fly (even after core code update). It can be another layer of security. | You can disable the wp-login page from your functions by hooking into login\_head:
```
add_action( 'login_head', 'wp_die');
```
(that's obviously a very clumsy way of doing it, but it prevents anyone from being able to login through that page. You could make that a redirect function, or a warning message, rather tha... |
10,161 | <p>I have a small script within theme's <code>functions.php</code> file that uses ajax, principle like this:</p>
<pre><code>add_action('admin_head', 'rw_script');
function rw_script() {
echo '
<script type="text/javascript">
// delete image
$(".delete_image").click(function(){
... | [
{
"answer_id": 10163,
"author": "mtekk",
"author_id": 1078,
"author_profile": "https://wordpress.stackexchange.com/users/1078",
"pm_score": 1,
"selected": false,
"text": "<p>You need to create a new instance of the class so that your constructor is called and your actions are registered.... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10161",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2051/"
] | I have a small script within theme's `functions.php` file that uses ajax, principle like this:
```
add_action('admin_head', 'rw_script');
function rw_script() {
echo '
<script type="text/javascript">
// delete image
$(".delete_image").click(function(){
var data = $(this).attr("rel")... | It's been a long time since this question, now my code has changed a lot. But after re-look at the code, and I think the request should be:
```
$.post(
ajaxurl,
{action: 'rw_delete_image', attach_id: data}, function(response){
alert(response); // debug
}
);
```
**not** `{action: 'rw_delete_image... |
10,168 | <p>I have a subfolder install of WP multisite, let's say at "domain.com".</p>
<p>I now need to load the WP environment in subdomains of domain.com, say "sub1.domain.com", "sub2.domain.com", ... "subN.domain.com". Note that these subdomains do not correspond to WP blogs. But I do need to have access to the logged in us... | [
{
"answer_id": 10171,
"author": "konus",
"author_id": 3414,
"author_profile": "https://wordpress.stackexchange.com/users/3414",
"pm_score": 2,
"selected": false,
"text": "<p>You could give a try to <a href=\"http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/\" rel=\"nofollo... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10168",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3419/"
] | I have a subfolder install of WP multisite, let's say at "domain.com".
I now need to load the WP environment in subdomains of domain.com, say "sub1.domain.com", "sub2.domain.com", ... "subN.domain.com". Note that these subdomains do not correspond to WP blogs. But I do need to have access to the logged in user, the da... | Use the defines to make it pick the site you want it to pick.
You can define these four to setup the $current\_site values properly: DOMAIN\_CURRENT\_SITE, PATH\_CURRENT\_SITE, SITE\_ID\_CURRENT\_SITE, BLOG\_ID\_CURRENT\_SITE.
If you check the wpmu\_current\_site() function in ms-load.php, you'll see that it uses th... |
10,175 | <p>Almost all themes display categories (with its permalink) by default. I am looking for similar type of code to add in my theme. From where can I get it?
To create custom taxonomies, I'm using <a href="http://wordpress.org/extend/plugins/more-taxonomies/" rel="noreferrer">More Taxonomies</a> plugin.</p>
| [
{
"answer_id": 10178,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 5,
"selected": true,
"text": "<p>The easiest way to list terms of custom taxonomy and display them would be to use</p>\n\n<pre><code> <?php ... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10175",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3411/"
] | Almost all themes display categories (with its permalink) by default. I am looking for similar type of code to add in my theme. From where can I get it?
To create custom taxonomies, I'm using [More Taxonomies](http://wordpress.org/extend/plugins/more-taxonomies/) plugin. | The easiest way to list terms of custom taxonomy and display them would be to use
```
<?php get_the_term_list( $id, $taxonomy, $before, $sep, $after ) ?>
```
For example in the loop, my custom taxonomy is 'jobs' list as li
```
<ul><?php echo get_the_term_list( $post->ID, 'jobs', '<li class="jobs_item">', ', ', '... |
10,176 | <p>I can change label of comments by altering Comment(s) from parameter of following function: <code>comments_popup_link('No Comments;', '1 Comment;', '% Comments;');</code>
But, seems that title attribute is returned from core modules.
Suggest me to alter title attribute without editing core modules.</p>
| [
{
"answer_id": 57363,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 3,
"selected": true,
"text": "<p>If you look into the function <code>comments_popup_link()</code> you will see the following code at the end:</p>\n\n<pr... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10176",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3411/"
] | I can change label of comments by altering Comment(s) from parameter of following function: `comments_popup_link('No Comments;', '1 Comment;', '% Comments;');`
But, seems that title attribute is returned from core modules.
Suggest me to alter title attribute without editing core modules. | If you look into the function `comments_popup_link()` you will see the following code at the end:
```
$title = the_title_attribute( array('echo' => 0 ) );
echo apply_filters( 'comments_popup_link_attributes', '' );
echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
comments_number( $zero, $... |
10,191 | <p>I'm trying to build a picture gallery with custom post type in my theme and I think i figure it out almost everything but the call in the template, I already have the custom post type in the functions.php, I have a Page with a custom call to the post type and it’s working (the post are showing in the page with the t... | [
{
"answer_id": 10193,
"author": "Scott",
"author_id": 3310,
"author_profile": "https://wordpress.stackexchange.com/users/3310",
"pm_score": 1,
"selected": false,
"text": "<p>So by the sounds of it your having problems with the function the_post_thumbnail. Essentially you just need that t... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10191",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I'm trying to build a picture gallery with custom post type in my theme and I think i figure it out almost everything but the call in the template, I already have the custom post type in the functions.php, I have a Page with a custom call to the post type and it’s working (the post are showing in the page with the temp... | ```
<a rel="lightbox" href="<?php $image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id,'large', true);
echo $image_url[0]; ?>">
<?php the_post_thumbnail('thumbnail'); ?>
</a>
```
Yeah the above (pos... |
10,197 | <p>I'm a wordpress beginner and at the moment struggling to get to grips with custom menus. I have created two menus. Wordpress tells me the theme supports two menus. I have</p>
<pre><code><?php wp_nav_menu('menu=services_menu'); ?>
</code></pre>
<p>Where I want one menu to appear. I have</p>
<pre><code><?p... | [
{
"answer_id": 10202,
"author": "Rev. Voodoo",
"author_id": 3429,
"author_profile": "https://wordpress.stackexchange.com/users/3429",
"pm_score": 1,
"selected": false,
"text": "<pre><code><?php wp_nav_menu( array('menu' => 'menu name' )); ?>\n</code></pre>\n\n<p>possibly?</p>\n"... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10197",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3425/"
] | I'm a wordpress beginner and at the moment struggling to get to grips with custom menus. I have created two menus. Wordpress tells me the theme supports two menus. I have
```
<?php wp_nav_menu('menu=services_menu'); ?>
```
Where I want one menu to appear. I have
```
<?php wp_nav_menu('menu=left_navigation'); ?>
``... | The problem is that [`wp_nav_menu()`](http://codex.wordpress.org/Function_Reference/wp_nav_menu) should really only *ever* be calling **`theme_location`**, *not* `menu`.
The Theme defines **menu locations**, and then places those menu locations in the template. The **user** defines *menus*, and *assigns menus to theme... |
10,209 | <p>I have been building a series of theme pages. On one page a users messages (post_type=messages) come in in a tab on the page. The content is displayed in place as is the title etc.... The content is shown again after the closing on the page. There is no that would let that happen in the theme. </p>
<p>Furthermore... | [
{
"answer_id": 10210,
"author": "Robin I Knight",
"author_id": 2957,
"author_profile": "https://wordpress.stackexchange.com/users/2957",
"pm_score": 1,
"selected": false,
"text": "<pre><code><?php $congigs = get_posts('post_type=items&author='.$current_user->ID.'&tag='.$bkp... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10209",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2957/"
] | I have been building a series of theme pages. On one page a users messages (post\_type=messages) come in in a tab on the page. The content is displayed in place as is the title etc.... The content is shown again after the closing on the page. There is no that would let that happen in the theme.
Furthermore the post\_... | ```
<?php $congigs = get_posts('post_type=items&author='.$current_user->ID.'&tag='.$bkpostid.'&numberposts=-1');
foreach($congigs as $posts) : $title = $posts->post_title; ?> <li><?php echo $title; ?></li>
<?php endforeach; ?>
``` |
10,220 | <p>I've done my sharing of hacking themes before, especially to replace the site title with a logo, but for newest thematic theme, I can't figure out where to edit the code to add my logo. I've checked header.php and the style.css but can't figure it out.</p>
<p><a href="http://wordpress.org/extend/themes/thematic" re... | [
{
"answer_id": 10221,
"author": "Rev. Voodoo",
"author_id": 3429,
"author_profile": "https://wordpress.stackexchange.com/users/3429",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://www.cozmoslabs.com/2009/05/28/add-a-header-image-to-thematic-the-easy-way/comment-page-2/#c... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10220",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3290/"
] | I've done my sharing of hacking themes before, especially to replace the site title with a logo, but for newest thematic theme, I can't figure out where to edit the code to add my logo. I've checked header.php and the style.css but can't figure it out.
<http://wordpress.org/extend/themes/thematic>
Appreciate any help... | The easiest way is to use a css background image for your logo.
Go to line 65 of default.css and change
```
#blog-title {
font-family:Arial,sans-serif;
font-size:34px;
font-weight:bold;
line-height:40px;
}
```
To This:
```
#blog-title {
background: url(images/path_to_your_logo.png) no-repeat;
displ... |
10,230 | <p>Here is the code I'm using to add a custom field to a post type I have set up. As you can see it creates an input box which allows me to add whatever I want. I want to put urls in this box (without the "http://", e.g. "example.com") and have them be automatically clickable. Is there a way?</p>
<pre><code>add_action... | [
{
"answer_id": 10227,
"author": "Otto",
"author_id": 2232,
"author_profile": "https://wordpress.stackexchange.com/users/2232",
"pm_score": 4,
"selected": true,
"text": "<p>If you're already using the SVN method, then keep using it. Trying to auto-upgrade an SVN site will probably fail du... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10230",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3239/"
] | Here is the code I'm using to add a custom field to a post type I have set up. As you can see it creates an input box which allows me to add whatever I want. I want to put urls in this box (without the "http://", e.g. "example.com") and have them be automatically clickable. Is there a way?
```
add_action("admin_init",... | If you're already using the SVN method, then keep using it. Trying to auto-upgrade an SVN site will probably fail due to all the extra .svn directories and such.
Auto-upgrade doesn't do anything special or different. It's just replacing the WordPress files with the new ones. SVN will do the same thing. |
10,233 | <p>This has only been a problem since I updated to Wordpress 3.1</p>
<p>I have a page that displays a list of custom post types. The page is the child of a parent page. There is a sidebar that lists sibling pages. The code for the two is conflicting somehow, and I can't get the list of pages to show up.</p>
<p>This i... | [
{
"answer_id": 10227,
"author": "Otto",
"author_id": 2232,
"author_profile": "https://wordpress.stackexchange.com/users/2232",
"pm_score": 4,
"selected": true,
"text": "<p>If you're already using the SVN method, then keep using it. Trying to auto-upgrade an SVN site will probably fail du... | 2011/02/23 | [
"https://wordpress.stackexchange.com/questions/10233",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | This has only been a problem since I updated to Wordpress 3.1
I have a page that displays a list of custom post types. The page is the child of a parent page. There is a sidebar that lists sibling pages. The code for the two is conflicting somehow, and I can't get the list of pages to show up.
This is the code to dis... | If you're already using the SVN method, then keep using it. Trying to auto-upgrade an SVN site will probably fail due to all the extra .svn directories and such.
Auto-upgrade doesn't do anything special or different. It's just replacing the WordPress files with the new ones. SVN will do the same thing. |
10,264 | <p>I have a WP site up and running for my wife and she attempted to install a text widget that linked to her Twitter account (she says HTML was taken from Twitter.com). I am not sure exactly what she did or what was going on, but now she gets the following error when going to /wp-admin of the site:</p>
<pre><code>Wor... | [
{
"answer_id": 10270,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Typically, I find these issues are related to database rights. Check the security for the DB and the user. Sorry, ... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10264",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3456/"
] | I have a WP site up and running for my wife and she attempted to install a text widget that linked to her Twitter account (she says HTML was taken from Twitter.com). I am not sure exactly what she did or what was going on, but now she gets the following error when going to /wp-admin of the site:
```
WordPress database... | ON DUPLICATE KEY UPDATE is one of several MySQL-specific things used by WP. Best I'm aware there is no equivalent in SQL-Server. You'll get a syntax error no matter unless you regexp\_replace() every query sent to the DB server in order to rewrite the SQL as needed for your specific engine. |
10,269 | <p>Today morning I updated my wordpress, everything was fine, but suddenly I came to know that if I click on any post which is not having custom taxonomies selected in it, are giving me 404 pages.</p>
<p>I thought this is due to some plugins, so I deactivated all the plugins, and then I checked, everything was working... | [
{
"answer_id": 10270,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Typically, I find these issues are related to database rights. Check the security for the DB and the user. Sorry, ... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10269",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1743/"
] | Today morning I updated my wordpress, everything was fine, but suddenly I came to know that if I click on any post which is not having custom taxonomies selected in it, are giving me 404 pages.
I thought this is due to some plugins, so I deactivated all the plugins, and then I checked, everything was working, then I a... | ON DUPLICATE KEY UPDATE is one of several MySQL-specific things used by WP. Best I'm aware there is no equivalent in SQL-Server. You'll get a syntax error no matter unless you regexp\_replace() every query sent to the DB server in order to rewrite the SQL as needed for your specific engine. |
10,285 | <p>How do I <code>query_posts</code> and only show results if a custom field is not empty or has a value.</p>
<p>I want to put in a URL in a custom field and only show these pages if there is a URL?</p>
<p>current code but I can't figure out the rest:</p>
<pre><code>$args = array( 'posts_per_page' => '10',
'... | [
{
"answer_id": 10286,
"author": "Anh Tran",
"author_id": 2051,
"author_profile": "https://wordpress.stackexchange.com/users/2051",
"pm_score": 4,
"selected": true,
"text": "<p>Try this code:</p>\n\n<pre><code>$args = array(\n'posts_per_page' => '10',\n'post_type' => 'programmes',\n... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10285",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31057/"
] | How do I `query_posts` and only show results if a custom field is not empty or has a value.
I want to put in a URL in a custom field and only show these pages if there is a URL?
current code but I can't figure out the rest:
```
$args = array( 'posts_per_page' => '10',
'post_type' => 'programmes',
'orderby'... | Try this code:
```
$args = array(
'posts_per_page' => '10',
'post_type' => 'programmes',
'meta_key' => 'popularityfig',
'meta_value' => '',
'meta_compare' => '!=',
'order' => 'DESC'
);
```
There're 2 arguments you might want to note in the code: `meta_value` and `meta_compare`. Using `meta_compare` with operator `!=... |
10,287 | <p>Is there a nice way to load a js file based on the post type being viewed? </p>
<p>I have a supplier which has a map on it but I only want the load the js when a single one is being viewed. I load the script in my functions.php file. </p>
| [
{
"answer_id": 10286,
"author": "Anh Tran",
"author_id": 2051,
"author_profile": "https://wordpress.stackexchange.com/users/2051",
"pm_score": 4,
"selected": true,
"text": "<p>Try this code:</p>\n\n<pre><code>$args = array(\n'posts_per_page' => '10',\n'post_type' => 'programmes',\n... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10287",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3365/"
] | Is there a nice way to load a js file based on the post type being viewed?
I have a supplier which has a map on it but I only want the load the js when a single one is being viewed. I load the script in my functions.php file. | Try this code:
```
$args = array(
'posts_per_page' => '10',
'post_type' => 'programmes',
'meta_key' => 'popularityfig',
'meta_value' => '',
'meta_compare' => '!=',
'order' => 'DESC'
);
```
There're 2 arguments you might want to note in the code: `meta_value` and `meta_compare`. Using `meta_compare` with operator `!=... |
10,297 | <p>As a custom menu item wp doesn't add the class current_page_item </p>
<p>All other links it does?</p>
<pre><code><ul class="nav" id="menu-mainmenu"><li class="menu-item menu-item-type-custom menu-item-home menu-item-21152" id="menu-item-21152"><a href="http://mydomain/">Home</a></li>
... | [
{
"answer_id": 10311,
"author": "wyrfel",
"author_id": 3104,
"author_profile": "https://wordpress.stackexchange.com/users/3104",
"pm_score": 1,
"selected": false,
"text": "<p>It's a bit hard for WP to figure that your custom menu item is the active one. They are for external links, after... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10297",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31057/"
] | As a custom menu item wp doesn't add the class current\_page\_item
All other links it does?
```
<ul class="nav" id="menu-mainmenu"><li class="menu-item menu-item-type-custom menu-item-home menu-item-21152" id="menu-item-21152"><a href="http://mydomain/">Home</a></li>
<li class="menu-item menu-item-type-post_type cur... | Can't you just target .current-menu-item along with .current\_page\_item? |
10,299 | <p>I have a WordPress site with well over 10k posts, and things are starting to get very slow whenever I am adding and editing posts. Pages load nice and fast for users, along with the admin lists of posts, but it is when writes or updates occur the server goes to 100% CPU and takes a long time (sometimes longer than P... | [
{
"answer_id": 10899,
"author": "anu",
"author_id": 490,
"author_profile": "https://wordpress.stackexchange.com/users/490",
"pm_score": 3,
"selected": false,
"text": "<p>InnoDB probably won't help you - page/row level locking helps mitigate contention, but it doesn't feel like that's you... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10299",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3470/"
] | I have a WordPress site with well over 10k posts, and things are starting to get very slow whenever I am adding and editing posts. Pages load nice and fast for users, along with the admin lists of posts, but it is when writes or updates occur the server goes to 100% CPU and takes a long time (sometimes longer than PHP'... | I would indeed switch to InnoDB. Table locking/row locking has long been discussed by many. I would always choose InnoDB hands down. However, [there is another profound reason for choosing InnoDB...CACHING](https://dba.stackexchange.com/questions/1/what-are-the-main-differences-between-innodb-and-myisam/2194#2194).
Wh... |
10,304 | <p>The first posts I wrote are now showing on the homepage. After Googling, the problem is because I am using query_posts to exclude a certain category on the main loop.</p>
<pre><code><?php query_posts($query_string . '&cat=-4'); ?>
</code></pre>
<hr>
<p>how can I still exclude this category, but not have... | [
{
"answer_id": 10308,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 1,
"selected": false,
"text": "<p>Simply add orderby to your query_posts</p>\n<pre><code><?php query_posts($query_string . '&cat=-4&... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10304",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | The first posts I wrote are now showing on the homepage. After Googling, the problem is because I am using query\_posts to exclude a certain category on the main loop.
```
<?php query_posts($query_string . '&cat=-4'); ?>
```
---
how can I still exclude this category, but not have my posts reversed? | Simply add orderby to your query\_posts
```
<?php query_posts($query_string . '&cat=-4&orderby=date&order=DESC'); ?>
```
Update
------
try:
```
global $wp_query;
$args = array_merge( $wp_query->query, array('cat' => -4,'orderby' => 'date','order' => 'ASC'));
query_posts( $args );
```
and if you still get the sam... |
10,309 | <p>How to display the WordPress user registration form (the form that appears in "www.mywebsite.com/wp-register.php" page) in the front end of my blog?</p>
<p>I have customised the registration form. But don't know how to call that form in the front end page. Any support will be really great help.</p>
<p>Thanks in ad... | [
{
"answer_id": 10321,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 3,
"selected": false,
"text": "<p>this <a href=\"http://digwp.com/2010/12/login-register-password-code/\">Article</a> provides a greate tutoria... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10309",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | How to display the WordPress user registration form (the form that appears in "www.mywebsite.com/wp-register.php" page) in the front end of my blog?
I have customised the registration form. But don't know how to call that form in the front end page. Any support will be really great help.
Thanks in advance. :) | The process involves 2 steps:
1. show the frontend form
2. save the data on submission
There are 3 different approach that comes to my mind to show the frontend:
* use the built-in registration form, editing styles, etc to make it more "frontend like"
* use a WordPress page/post, and display form using a shortcode
*... |
10,327 | <p>Is ther a way of displaying the facebook profile picture in the <a href="http://wordpress.org/extend/plugins/wp-fb-autoconnect/" rel="nofollow noreferrer">WP-FB AutoConnect</a> widget?</p>
<p>Like the bbPress login widget:</p>
<p><img src="https://i.stack.imgur.com/WoLnj.png" alt="enter image description here"></p... | [
{
"answer_id": 11524,
"author": "marvinhagemeister",
"author_id": 3701,
"author_profile": "https://wordpress.stackexchange.com/users/3701",
"pm_score": 0,
"selected": false,
"text": "<p>Check the plugin's settings or the widget settings. The page of <a href=\"http://wordpress.org/extend/... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10327",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/781/"
] | Is ther a way of displaying the facebook profile picture in the [WP-FB AutoConnect](http://wordpress.org/extend/plugins/wp-fb-autoconnect/) widget?
Like the bbPress login widget:

The WP-FB AutoConnect widget doesn't show it (I think it is like this... | Hi JanoChen,
------------
WP-FP-AutoConnect create a function that gets the Facebook Profile image and outputs it as an avatar.
The function is `jfb_wp_avatar` and it can be added to your template.
You have to enable the option in the plugin settings.
Here is how the function is defined in the plugin:
```
/**
* ... |
10,329 | <p>I have added a custom field to some posts called 'frontpagerank'
The plan is to order the posts by this value but first I just want to filter out any that don't use a front page rank.
I have achieved this by putting the relevant posts into another array.
But what to do next?</p>
<p>Also tried a query:
$the_quer... | [
{
"answer_id": 10330,
"author": "Tom",
"author_id": 3482,
"author_profile": "https://wordpress.stackexchange.com/users/3482",
"pm_score": 1,
"selected": false,
"text": "<p>Haven't tried it, but this seems like it should work:</p>\n\n<pre><code>$recent = new WP_Query(\"meta_key=your-custo... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10329",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/970/"
] | I have added a custom field to some posts called 'frontpagerank'
The plan is to order the posts by this value but first I just want to filter out any that don't use a front page rank.
I have achieved this by putting the relevant posts into another array.
But what to do next?
Also tried a query:
$the\_query = new WP\_... | >
> I have added a custom field to some posts called 'frontpagerank'
>
>
>
Then shouldn't the WP\_Query args reference that key then, eg.
```
'meta_key' => 'frontpagerank'
```
If i follow, you want to check for posts that have this key, and you're expecting a numeric value, so i'll naturally assume you don't w... |
10,335 | <p>I'd like to store information about TV shows this way:</p>
<p>series (general information about the series)</p>
<p>--episode 1 (video of ep.1 + info about episode)</p>
<p>--episode 2 (video of ep.2 + info about episode)</p>
<p>...</p>
<p>--episode n</p>
<p>Taxonomies could be used for some of the additional in... | [
{
"answer_id": 10339,
"author": "scribu",
"author_id": 205,
"author_profile": "https://wordpress.stackexchange.com/users/205",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, it's possible, by using the post_parent field in the wp_posts table.</p>\n\n<p>You will have to write a custom... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10335",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3483/"
] | I'd like to store information about TV shows this way:
series (general information about the series)
--episode 1 (video of ep.1 + info about episode)
--episode 2 (video of ep.2 + info about episode)
...
--episode n
Taxonomies could be used for some of the additional info, such as production year, actors, network,... | I'm using this code for a metabox in a current project I'm working on:
```
function parent_select ($parent_type) {
global $post;
global $wpdb;
$query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = '{$parent_type}' AND post_status = 'publish' ORDER BY post_title";
$results = $wpdb->get_re... |
10,344 | <p>Is there one last filter that is ran over the widgets before they are sent out to the browser? I would like to add a filter that adds <code>rel="nofollow"</code> to all links in all widgets.</p>
<p>For instance, I can add a filter to the text widget:</p>
<pre><code>add_filter('widget_text', 'xrvel_nfp_modify_nofol... | [
{
"answer_id": 10337,
"author": "scribu",
"author_id": 205,
"author_profile": "https://wordpress.stackexchange.com/users/205",
"pm_score": 3,
"selected": true,
"text": "<p>It normally takes at most 15 minutes before the Extend page is refreshed, so just give it a little while.</p>\n"
}... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10344",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10/"
] | Is there one last filter that is ran over the widgets before they are sent out to the browser? I would like to add a filter that adds `rel="nofollow"` to all links in all widgets.
For instance, I can add a filter to the text widget:
```
add_filter('widget_text', 'xrvel_nfp_modify_nofollow');
```
But I don't want to... | It normally takes at most 15 minutes before the Extend page is refreshed, so just give it a little while. |
10,357 | <p>I'm trying to show result for a custom field that is not empty on a custom post type but getting no results?</p>
<pre><code> <?php
if (have_posts()) :
$args = array(
'post_type' => 'programmes',
... | [
{
"answer_id": 10368,
"author": "Simon Blackbourn",
"author_id": 2877,
"author_profile": "https://wordpress.stackexchange.com/users/2877",
"pm_score": 4,
"selected": true,
"text": "<p>you're missing an array within the meta_query element:</p>\n\n<pre><code>$args = array(\n 'pos... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10357",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31057/"
] | I'm trying to show result for a custom field that is not empty on a custom post type but getting no results?
```
<?php
if (have_posts()) :
$args = array(
'post_type' => 'programmes',
... | you're missing an array within the meta\_query element:
```
$args = array(
'post_type' => 'programmes',
'meta_query' => array(
array(
'key' => 'linktovideocatchup',
'value' => '',
... |
10,364 | <p>I took a code straight out of one of my themes I created, and it's a list of all 50 states in an unordered list packed into a widget you can just drag and drop on the sidebar.</p>
<p>The problem is, when I try using this code in a PLUGIN file, I get the following error:</p>
<p><code>Fatal error: Call to a member f... | [
{
"answer_id": 10366,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 5,
"selected": true,
"text": "<p>try replacing :</p>\n\n<pre><code>register_widget('States_Widget');\n</code></pre>\n\n<p>with:</p>\n\n<pre><co... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10364",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2415/"
] | I took a code straight out of one of my themes I created, and it's a list of all 50 states in an unordered list packed into a widget you can just drag and drop on the sidebar.
The problem is, when I try using this code in a PLUGIN file, I get the following error:
`Fatal error: Call to a member function register() on ... | try replacing :
```
register_widget('States_Widget');
```
with:
```
add_action('widgets_init', 'register_states_widget');
function register_states_widget() {
register_widget('States_Widget');
}
``` |
10,369 | <p>I'm working on my first shortcode, examples in Shortcode API are not suitable for starters, so I'm almost sure I'm doing it wrong!</p>
<p>My shortcode:</p>
<pre><code>function hello( $atts ) {
extract( shortcode_atts( array(
'foo' => 'something',
'bar' => 'something else',
), ... | [
{
"answer_id": 10372,
"author": "Simon Blackbourn",
"author_id": 2877,
"author_profile": "https://wordpress.stackexchange.com/users/2877",
"pm_score": 2,
"selected": false,
"text": "<p>This should do it:</p>\n\n<pre><code> function hello( $atts ) {\n\n extract( shortcode_atts( ... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10369",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1869/"
] | I'm working on my first shortcode, examples in Shortcode API are not suitable for starters, so I'm almost sure I'm doing it wrong!
My shortcode:
```
function hello( $atts ) {
extract( shortcode_atts( array(
'foo' => 'something',
'bar' => 'something else',
), $atts ) );
return '... | You are return two times! The first return exit the function, so your shortcode outputs always "Hello World".
Correct code:
```
function hello( $atts ) {
extract( shortcode_atts( array(
'foo' => 'something',
'bar' => 'something else',
), $atts ) );
print_r($atts); // Remove, when you are fine with... |
10,383 | <p>I want to get all categories in a new page which doesn't include any post. I tried wp_list_categories(); function. But it show only "No category" message.
How do I do it?</p>
| [
{
"answer_id": 10384,
"author": "Simon Scarfe",
"author_id": 3489,
"author_profile": "https://wordpress.stackexchange.com/users/3489",
"pm_score": 2,
"selected": false,
"text": "<p>This will only display the categories if there are posts associated with them, make sure that there are pos... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10383",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I want to get all categories in a new page which doesn't include any post. I tried wp\_list\_categories(); function. But it show only "No category" message.
How do I do it? | This will only display the categories if there are posts associated with them, make sure that there are posts in your WordPress database. However, you might try:
```
wp_list_categories(array('hide_empty'=>0));
```
which will override that functionality. |
10,385 | <p>So I upgraded to 3.1 now I have a white band above the header of my website in the frontend when I'm logged in, I know this should be the control menu, but just a white band :-(</p>
| [
{
"answer_id": 10386,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 3,
"selected": true,
"text": "<p>you are correct, that is for the admin bar. add this code to functions.php to disable the admin bar if you wis... | 2011/02/24 | [
"https://wordpress.stackexchange.com/questions/10385",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31057/"
] | So I upgraded to 3.1 now I have a white band above the header of my website in the frontend when I'm logged in, I know this should be the control menu, but just a white band :-( | you are correct, that is for the admin bar. add this code to functions.php to disable the admin bar if you wish
```
<?php
/* Disable the Admin Bar. */
remove_action( 'init', 'wp_admin_bar_init' );
?>
```
if you want to use it then check your source for
```
<div id="wpadminbar">
<div class="quicklinks">... |
10,391 | <p>I expected that wp3.1 with the support for archive-{post_type}.php would solve my problems. However, I am still struggling to get it working. </p>
<p>What I want is: a custom date-based archive page per post-type, which displays years and months. Once you click on a year of a month, you'll go to another archive pag... | [
{
"answer_id": 10386,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 3,
"selected": true,
"text": "<p>you are correct, that is for the admin bar. add this code to functions.php to disable the admin bar if you wis... | 2011/02/25 | [
"https://wordpress.stackexchange.com/questions/10391",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3323/"
] | I expected that wp3.1 with the support for archive-{post\_type}.php would solve my problems. However, I am still struggling to get it working.
What I want is: a custom date-based archive page per post-type, which displays years and months. Once you click on a year of a month, you'll go to another archive page which o... | you are correct, that is for the admin bar. add this code to functions.php to disable the admin bar if you wish
```
<?php
/* Disable the Admin Bar. */
remove_action( 'init', 'wp_admin_bar_init' );
?>
```
if you want to use it then check your source for
```
<div id="wpadminbar">
<div class="quicklinks">... |
10,394 | <ul>
<li>The plugin should work with un-registered users also.</li>
<li>Its not mandatory for plugin to add rating system to posts/pages. I need thumbs up-down rating system only for comments.</li>
</ul>
| [
{
"answer_id": 10386,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 3,
"selected": true,
"text": "<p>you are correct, that is for the admin bar. add this code to functions.php to disable the admin bar if you wis... | 2011/02/25 | [
"https://wordpress.stackexchange.com/questions/10394",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3411/"
] | * The plugin should work with un-registered users also.
* Its not mandatory for plugin to add rating system to posts/pages. I need thumbs up-down rating system only for comments. | you are correct, that is for the admin bar. add this code to functions.php to disable the admin bar if you wish
```
<?php
/* Disable the Admin Bar. */
remove_action( 'init', 'wp_admin_bar_init' );
?>
```
if you want to use it then check your source for
```
<div id="wpadminbar">
<div class="quicklinks">... |
10,402 | <p>So WP 3.1 introduces the fancy WP_List_Class() causing me to rewrite all my custom admin tables. Fair enough. But...in the good'ol days, i was able to call my plugin methods using <code>$this->method()</code> as i included the page file within the method that got hooked to via <code>add_submenu_page()</code>. Tha... | [
{
"answer_id": 10405,
"author": "Peter Rowell",
"author_id": 1958,
"author_profile": "https://wordpress.stackexchange.com/users/1958",
"pm_score": 0,
"selected": false,
"text": "<p><strong>Take 2:</strong></p>\n\n<p>My first answer was ... not right.</p>\n\n<p>Basically, PHP does not sup... | 2011/02/25 | [
"https://wordpress.stackexchange.com/questions/10402",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3104/"
] | So WP 3.1 introduces the fancy WP\_List\_Class() causing me to rewrite all my custom admin tables. Fair enough. But...in the good'ol days, i was able to call my plugin methods using `$this->method()` as i included the page file within the method that got hooked to via `add_submenu_page()`. That was nice and somewhat el... | This is a common design pattern, and I would have solved it in the same way you did. Let `My_WP_List_Class` extend `WP_List_Class`, and pass a "configuration" object to it. You could even make the relation more explicit by defining an interface your configuration object must adhere to:
```
interface My_WP_List_Configu... |