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
84,097
<p>I'm using a custom theme not developed by myself that seems to have disabled/ or doesn't have the function for any and all shortcodes, whether its a WordPress shortcode or a plugin shortcode. I mostly need this function to work via a plugin generated shortcodes. I've checked several things to see what is causing it ...
[ { "answer_id": 84113, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 0, "selected": false, "text": "<p>Your Loop is correct. It uses <a href=\"http://codex.wordpress.org/Function_Reference/the_content\" rel=\"nof...
2013/02/01
[ "https://wordpress.stackexchange.com/questions/84097", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20553/" ]
I'm using a custom theme not developed by myself that seems to have disabled/ or doesn't have the function for any and all shortcodes, whether its a WordPress shortcode or a plugin shortcode. I mostly need this function to work via a plugin generated shortcodes. I've checked several things to see what is causing it but...
So I finally found a solution!!! After many weeks of searching and trying different solutions, it was just a matter of removing "get\_" from a reference of "the\_content" in my page.php I changed this ``` <?php function sup($text){ $true = preg_replace('#(\d+)(st|th|nd|rd)#...
84,105
<p>I'm trying to Query some lattitude and logitude and then I get some long numbers and apperently the Query dont like that.</p> <p>Let says I have these in the database</p> <pre><code>Meta-key: lat Meta-value: 54.3415000 Meta-key: lng Meta-value: 10.1254100 </code></pre> <p>and do a query like this:</p> <pre><co...
[ { "answer_id": 105559, "author": "Amit", "author_id": 20, "author_profile": "https://wordpress.stackexchange.com/users/20", "pm_score": 0, "selected": false, "text": "<p>I used something similar a couple of years ago, I finally used raw sql (can't remember why) but the main difference I ...
2013/02/01
[ "https://wordpress.stackexchange.com/questions/84105", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20135/" ]
I'm trying to Query some lattitude and logitude and then I get some long numbers and apperently the Query dont like that. Let says I have these in the database ``` Meta-key: lat Meta-value: 54.3415000 Meta-key: lng Meta-value: 10.1254100 ``` and do a query like this: ``` $args['meta_query'] = array( ...
Your problem is this: ``` CAST(wp_postmeta.meta_value AS SIGNED) ``` Run a simple SQL query (command line or PhpMyAdmin, whatever you like) like `SELECT CAST('1.2' as SIGNED)` and you will see that the value returned is `1`. What causes that cast is `'type' => 'NUMERIC',`. You can pass `DECIMAL` to `meta_query` in...
84,107
<p>In functions.php of a theme makes a call to <code>show_admin_bar(false)</code> which hides admin bar in front end:</p> <pre><code>if (!is_admin()) { wp_deregister_style( 'bp-admin-bar' ); if ( function_exists( 'show_admin_bar' ) ) { show_admin_bar( false ); remove_action( 'bp_init', 'bp_...
[ { "answer_id": 84108, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 4, "selected": true, "text": "<p>First off: This Theme is so doing it wrong. One should not simply stuff plain calls in functions.php files. Those sh...
2013/02/01
[ "https://wordpress.stackexchange.com/questions/84107", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2261/" ]
In functions.php of a theme makes a call to `show_admin_bar(false)` which hides admin bar in front end: ``` if (!is_admin()) { wp_deregister_style( 'bp-admin-bar' ); if ( function_exists( 'show_admin_bar' ) ) { show_admin_bar( false ); remove_action( 'bp_init', 'bp_core_load_buddybar_css' )...
First off: This Theme is so doing it wrong. One should not simply stuff plain calls in functions.php files. Those should be wrapped and hook. Best to `after_setup_theme()`. You could btw try the same hook.
84,126
<p>Let's say I create a custom post type called 'new projects', with capability type = page and slug = 'projects'.</p> <p>Let's then say that I create a new page of type 'new projects' and name it 'my new project'. By default the URL would be represented as:</p> <p>mysite.com/projects/my-new-project/</p> <p>However,...
[ { "answer_id": 84137, "author": "Christian Rios", "author_id": 26364, "author_profile": "https://wordpress.stackexchange.com/users/26364", "pm_score": 0, "selected": false, "text": "<p>Not sure I'm following entirely and/or if this is the best way around it... but you could try creating ...
2013/02/01
[ "https://wordpress.stackexchange.com/questions/84126", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26880/" ]
Let's say I create a custom post type called 'new projects', with capability type = page and slug = 'projects'. Let's then say that I create a new page of type 'new projects' and name it 'my new project'. By default the URL would be represented as: mysite.com/projects/my-new-project/ However, if I want the page **my...
You can kind of fake it before the main query is run with the [`pre_get_posts`](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts) action: ``` function wpa84126_single_project_archive( $query ){ if( ! is_admin() && $query->is_main_query() && $query->is_post_type_archive( 'new_pro...
84,132
<p>I use WP_DEBUG_LOG in my development environment and have no issues with debug.log being in the wp-content directory.</p> <p>Sometimes I turn on WP_DEBUG in production when I need to debug something, and I still want to use the log but would like to redirect it to something outside my web root. Is this possible usi...
[ { "answer_id": 84136, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 0, "selected": false, "text": "<p>Afaik, you can't change the location for the default debug file. What you can change is the location for the MU err...
2013/02/01
[ "https://wordpress.stackexchange.com/questions/84132", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/300/" ]
I use WP\_DEBUG\_LOG in my development environment and have no issues with debug.log being in the wp-content directory. Sometimes I turn on WP\_DEBUG in production when I need to debug something, and I still want to use the log but would like to redirect it to something outside my web root. Is this possible using WP\_...
It turns out that all WP\_DEBUG\_LOG does is: ``` ini_set( 'log_errors', 1 ); ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' ); ``` So, if you want to change the log location for WP\_DEBUG\_LOG in a plugin or theme, [webaware's answer](https://wordpress.stackexchange.com/a/84171/300) is best. If you just want t...
84,138
<p>I've got some jQuery that interacts with items on the post and page editor screens. However, the script is also loading on other admin screens that are driven by post.php</p> <p>Is there a way to target the post/page editor screen exclusively?</p> <p>I'm currently using:</p> <pre><code>global $pagenow; if( 'post....
[ { "answer_id": 84144, "author": "Sven", "author_id": 26886, "author_profile": "https://wordpress.stackexchange.com/users/26886", "pm_score": 0, "selected": false, "text": "<p>There are a number of possibilities:</p>\n\n<p>1 - Add checks to your javascript to verify that the element you'r...
2013/02/01
[ "https://wordpress.stackexchange.com/questions/84138", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6620/" ]
I've got some jQuery that interacts with items on the post and page editor screens. However, the script is also loading on other admin screens that are driven by post.php Is there a way to target the post/page editor screen exclusively? I'm currently using: ``` global $pagenow; if( 'post.php' == $pagenow ) { //jQu...
Use the WP\_Screen object to tell where you are at in the admin instead. Much more convenient. ``` $screen = get_current_screen(); if ( $screen->id == 'edit-post' ) { // you're on the posts screen } ``` Note that you have to wait until at least the admin\_head hook to run for the current screen to have been deter...
84,139
<p>I don't want to ask the user to install this and that plugin, I want my theme to be 100% active active without the need to install a plugin like <a href="http://wordpress.org/extend/plugins/wp-postviews/" rel="nofollow">wp-postviews</a> plugin, so how can i do that. I want to include it directly in functions.php fil...
[ { "answer_id": 84143, "author": "Sven", "author_id": 26886, "author_profile": "https://wordpress.stackexchange.com/users/26886", "pm_score": 0, "selected": false, "text": "<p>You could include the particular plugin in your theme directory and then fire a function on <code>after_switch_th...
2013/02/01
[ "https://wordpress.stackexchange.com/questions/84139", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24483/" ]
I don't want to ask the user to install this and that plugin, I want my theme to be 100% active active without the need to install a plugin like [wp-postviews](http://wordpress.org/extend/plugins/wp-postviews/) plugin, so how can i do that. I want to include it directly in functions.php file? Thanks in advance.
That was so easy! I just included the plugin folder in my theme Then i included it. ``` include(your-theme-path . 'wp-postviews/wp-postviews.php'); ``` That was it!
84,149
<p>This is a terrible user experience when I'm trying to do the most simple thing and it never works. There are many pages with "instructions" how to do this and none of the "instructions" work.</p> <p>Now we hate Wordpress for making the most simple thing just not possible. </p> <pre><code>## Solution ## </code></pr...
[ { "answer_id": 84153, "author": "Sven", "author_id": 26886, "author_profile": "https://wordpress.stackexchange.com/users/26886", "pm_score": 1, "selected": false, "text": "<p>I believe this is fairly easy. You can disable comments in your WordPress settings.</p>\n\n<p>Go to your WordPres...
2013/02/01
[ "https://wordpress.stackexchange.com/questions/84149", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6919/" ]
This is a terrible user experience when I'm trying to do the most simple thing and it never works. There are many pages with "instructions" how to do this and none of the "instructions" work. Now we hate Wordpress for making the most simple thing just not possible. ``` ## Solution ## ``` This only worked when doin...
WordPress admin screen -> Settings -> Discussion -> "Allow people to post comments on new articles". Uncheck it. For existing posts, go to Posts -> All Posts. You can click "Quick Edit" on any post to find the "Allow Comments" checkbox and turn them off for that post. To bulk-edit existing posts, you can select all t...
84,172
<p><code>&lt;?php wp_head(); ?&gt;</code> from my default wp theme generates</p> <pre><code>&lt;script type='text/javascript' src='http://example.com/wp-includes/js/comment-reply.min.js?ver=3.5.1'&gt;&lt;/script&gt; &lt;script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery.js?ver=1.8.3'&gt...
[ { "answer_id": 84153, "author": "Sven", "author_id": 26886, "author_profile": "https://wordpress.stackexchange.com/users/26886", "pm_score": 1, "selected": false, "text": "<p>I believe this is fairly easy. You can disable comments in your WordPress settings.</p>\n\n<p>Go to your WordPres...
2013/02/02
[ "https://wordpress.stackexchange.com/questions/84172", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2215/" ]
`<?php wp_head(); ?>` from my default wp theme generates ``` <script type='text/javascript' src='http://example.com/wp-includes/js/comment-reply.min.js?ver=3.5.1'></script> <script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script> ``` The question is... What is gener...
WordPress admin screen -> Settings -> Discussion -> "Allow people to post comments on new articles". Uncheck it. For existing posts, go to Posts -> All Posts. You can click "Quick Edit" on any post to find the "Allow Comments" checkbox and turn them off for that post. To bulk-edit existing posts, you can select all t...
84,200
<p>I made a custom plugin for <strong>POLL</strong> . When I activate it, default icon is coming there on sidebar. I want to change this default icon. Here is my code which I wrote in <strong>init.php</strong> file. </p> <pre><code>add_action('admin_menu', 'mt_add_pages'); // action function for above hook function...
[ { "answer_id": 84203, "author": "Rajeev Vyas", "author_id": 6961, "author_profile": "https://wordpress.stackexchange.com/users/6961", "pm_score": 4, "selected": true, "text": "<p>Take a close look at add_menu_page hook, it provides argument to supply with icon url</p>\n\n<pre><code>&lt;?...
2013/02/02
[ "https://wordpress.stackexchange.com/questions/84200", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26188/" ]
I made a custom plugin for **POLL** . When I activate it, default icon is coming there on sidebar. I want to change this default icon. Here is my code which I wrote in **init.php** file. ``` add_action('admin_menu', 'mt_add_pages'); // action function for above hook function mt_add_pages() { // Add a new top-le...
Take a close look at add\_menu\_page hook, it provides argument to supply with icon url ``` <?php add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); ``` <http://codex.wordpress.org/Function_Reference/add_menu_page> ``` add_menu_...
84,208
<p><strong>Introduce</strong> I am currently working on a slider plugin to learn a lot of PHP and WordPress. I have create some repeatable field with javascript. </p> <p><strong>Some functional details:</strong></p> <ul> <li>When the user is clicking on a button, the last row will cloned and all values will reset. </...
[ { "answer_id": 84203, "author": "Rajeev Vyas", "author_id": 6961, "author_profile": "https://wordpress.stackexchange.com/users/6961", "pm_score": 4, "selected": true, "text": "<p>Take a close look at add_menu_page hook, it provides argument to supply with icon url</p>\n\n<pre><code>&lt;?...
2013/02/02
[ "https://wordpress.stackexchange.com/questions/84208", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25971/" ]
**Introduce** I am currently working on a slider plugin to learn a lot of PHP and WordPress. I have create some repeatable field with javascript. **Some functional details:** * When the user is clicking on a button, the last row will cloned and all values will reset. * Add an increase to the javascript code for crea...
Take a close look at add\_menu\_page hook, it provides argument to supply with icon url ``` <?php add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); ``` <http://codex.wordpress.org/Function_Reference/add_menu_page> ``` add_menu_...
84,218
<p>i have implemented the frontend form, which enables UNREGISTERED users to post on my site.</p> <p>Everything in working perfectly, the only problem I have is with the implementation of the captcha.</p> <p>All of the captcha solutions I found needs to put some outer file in the form action. But my form has this syn...
[ { "answer_id": 84219, "author": "david.binda", "author_id": 14022, "author_profile": "https://wordpress.stackexchange.com/users/14022", "pm_score": 1, "selected": false, "text": "<p>Try <a href=\"http://wordpress.org/extend/plugins/really-simple-captcha/\" rel=\"nofollow\">Really Simple ...
2013/02/02
[ "https://wordpress.stackexchange.com/questions/84218", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26912/" ]
i have implemented the frontend form, which enables UNREGISTERED users to post on my site. Everything in working perfectly, the only problem I have is with the implementation of the captcha. All of the captcha solutions I found needs to put some outer file in the form action. But my form has this syntax: ``` <form ...
Try [Really Simple Captcha WodPress plugin](http://wordpress.org/extend/plugins/really-simple-captcha/). Here is a "how to" for implementing Really Simple Captcha for custom plugins: <http://www.lost-in-code.com/platforms/wordpress/wordpress-plugins/wordpress-using-really-simple-captcha/>
84,254
<p>I'm developing a plugin to display stats for downloads and various other information that developers might want to display on their sites about what they have developed.</p> <p>I've found documentation on some of what I need and dug up some other undocumented resources I can use, but the one thing I still haven't b...
[ { "answer_id": 84329, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 2, "selected": false, "text": "<p>Here is one idea:</p>\n\n<p>You always have the possibility to scrape the plugin's download html page:</p>\n\n...
2013/02/02
[ "https://wordpress.stackexchange.com/questions/84254", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15299/" ]
I'm developing a plugin to display stats for downloads and various other information that developers might want to display on their sites about what they have developed. I've found documentation on some of what I need and dug up some other undocumented resources I can use, but the one thing I still haven't been able t...
Here is one idea: You always have the possibility to scrape the plugin's download html page: ``` http://wordpress.org/extend/plugins/some-plugin-slug/stats/ ``` while you don't have any json/xml/rss sources with the today's download counter. The html part you are interested in has this form: ``` <div id="history...
84,258
<p>I am using this following code in my functions file to hide and add some custom columns to my post-edit screen in wp-admin.</p> <p>I am now trying to get the post list to sort by a post meta field (last name). I've read through many tutorials on how to do this, but I can't find anything that matches what I have. </...
[ { "answer_id": 84260, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 4, "selected": true, "text": "<p>Something like this should work:</p>\n\n<pre><code>function wpa84258_admin_posts_sort_last_name( $query ){\n glob...
2013/02/02
[ "https://wordpress.stackexchange.com/questions/84258", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23492/" ]
I am using this following code in my functions file to hide and add some custom columns to my post-edit screen in wp-admin. I am now trying to get the post list to sort by a post meta field (last name). I've read through many tutorials on how to do this, but I can't find anything that matches what I have. I don't ne...
Something like this should work: ``` function wpa84258_admin_posts_sort_last_name( $query ){ global $pagenow; if( is_admin() && 'edit.php' == $pagenow && !isset( $_GET['orderby'] ) && !isset( $_GET['post_type'] ) ){ $query->set( 'meta_key', 'last_name' ); $query-...
84,292
<p>I'm running a family wordpress blog: <a href="http://www.kjirstiandtom.com" rel="nofollow">http://www.kjirstiandtom.com</a></p> <p>We have a lot of pictures we put up for family. I'm using the twenty-eleven theme, which I love. I did minor css edits to change colors and fonts, but it's otherwise pretty much stock.<...
[ { "answer_id": 84260, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 4, "selected": true, "text": "<p>Something like this should work:</p>\n\n<pre><code>function wpa84258_admin_posts_sort_last_name( $query ){\n glob...
2013/02/03
[ "https://wordpress.stackexchange.com/questions/84292", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26938/" ]
I'm running a family wordpress blog: <http://www.kjirstiandtom.com> We have a lot of pictures we put up for family. I'm using the twenty-eleven theme, which I love. I did minor css edits to change colors and fonts, but it's otherwise pretty much stock. Resizing works great... until you get really skinny (e.g. iphone ...
Something like this should work: ``` function wpa84258_admin_posts_sort_last_name( $query ){ global $pagenow; if( is_admin() && 'edit.php' == $pagenow && !isset( $_GET['orderby'] ) && !isset( $_GET['post_type'] ) ){ $query->set( 'meta_key', 'last_name' ); $query-...
84,303
<p>I have created portfolio page which contains a image-slid-menu for navigation. For an menu item to appear as open, javascript gets instruction like ?id=0 appended to the url. for instance portfolio/art.php?id=0. However wordpress does not allow url slug containing ? or = for pages. What should I do now? I already se...
[ { "answer_id": 84260, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 4, "selected": true, "text": "<p>Something like this should work:</p>\n\n<pre><code>function wpa84258_admin_posts_sort_last_name( $query ){\n glob...
2013/02/03
[ "https://wordpress.stackexchange.com/questions/84303", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26842/" ]
I have created portfolio page which contains a image-slid-menu for navigation. For an menu item to appear as open, javascript gets instruction like ?id=0 appended to the url. for instance portfolio/art.php?id=0. However wordpress does not allow url slug containing ? or = for pages. What should I do now? I already setup...
Something like this should work: ``` function wpa84258_admin_posts_sort_last_name( $query ){ global $pagenow; if( is_admin() && 'edit.php' == $pagenow && !isset( $_GET['orderby'] ) && !isset( $_GET['post_type'] ) ){ $query->set( 'meta_key', 'last_name' ); $query-...
84,313
<p>How do you run two Wordpress blogs with different themes using one database where the content remains the same in both sites? The issue that I am getting is at the Domain mapping in both blogs.</p>
[ { "answer_id": 84320, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 0, "selected": false, "text": "<p>Not sure if it will be enough but this two plugins should give you most of what you want\n<a href=\"http:/...
2013/02/03
[ "https://wordpress.stackexchange.com/questions/84313", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22513/" ]
How do you run two Wordpress blogs with different themes using one database where the content remains the same in both sites? The issue that I am getting is at the Domain mapping in both blogs.
I'll try to explain how it might be done, but not sure it will work: 1. Install 2nd website with single db (2 copies). 2. Create new table in your db. Call it `wp_options2` and copy everything from `wp_options` into the new table 3. in second install in `wp-config.php`, before `if ( !defined('ABSPATH') )` add ``` def...
84,318
<p>I'm using the below code to get all the pages under the custom taxonomy terms, and it shows all the pages. What i want is to limit this and gets only say the last two pages published under the custom taxonomy. </p> <p>The posts_per_page=1 is not working here and show all pages.</p> <pre><code>&lt;?php $post_type =...
[ { "answer_id": 84330, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 3, "selected": true, "text": "<p>Your <code>WP_Query</code> is formed incorrectly. See <a href=\"http://codex.wordpress.org/Class_Reference/WP...
2013/02/03
[ "https://wordpress.stackexchange.com/questions/84318", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11917/" ]
I'm using the below code to get all the pages under the custom taxonomy terms, and it shows all the pages. What i want is to limit this and gets only say the last two pages published under the custom taxonomy. The posts\_per\_page=1 is not working here and show all pages. ``` <?php $post_type = 'page'; // Get all t...
Your `WP_Query` is formed incorrectly. See [WP\_Query Taxonomy Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters). Try this code: ``` <?php $post_type = 'page'; // Get all the taxonomies for this post type $taxonomies = get_object_taxonomies($post_type); // names (default) foreach( $...
84,324
<p>I have a problem with a custom WP_Query. I want a page with all posts with a specific tag. This is the code I'm using: </p> <pre><code>&lt;?php //save old query $temp = $wp_query; //clear $wp_query; $wp_query= null; ?&gt; &lt;?php // The Query $wp_query = new WP_Query(); $paged = (get_query_var('paged')...
[ { "answer_id": 84326, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 0, "selected": false, "text": "<h2>Your query has no <a href=\"http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters\" rel=\"nof...
2013/02/03
[ "https://wordpress.stackexchange.com/questions/84324", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13214/" ]
I have a problem with a custom WP\_Query. I want a page with all posts with a specific tag. This is the code I'm using: ``` <?php //save old query $temp = $wp_query; //clear $wp_query; $wp_query= null; ?> <?php // The Query $wp_query = new WP_Query(); $paged = (get_query_var('paged')) ? get_query_var('pag...
Finally I've figured out the correct coding for this problem: ``` <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $wp_query = new WP_Query(); $wp_query->query('tag=concurs&posts_per_page='.get_option('posts_per_page').'&paged=' . $paged); ?> <?php if ($wp_query->have_posts()) : ?> <?php whil...
84,336
<p>Im having a problem where for some reason, a basic loop im trying to add to a sidebar keeps....keeps looping on interior pages (single and page .php ) but not on index.php.</p> <p>on index.php (home page) is fine.</p> <p>for example, i wanted the loop to populate an unordered lists line items, so i went about it l...
[ { "answer_id": 84338, "author": "Sven", "author_id": 26886, "author_profile": "https://wordpress.stackexchange.com/users/26886", "pm_score": 3, "selected": true, "text": "<p>Add <code>wp_reset_query();</code> after your loop to prevent other loops on the page (for example, the navigation...
2013/02/03
[ "https://wordpress.stackexchange.com/questions/84336", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12944/" ]
Im having a problem where for some reason, a basic loop im trying to add to a sidebar keeps....keeps looping on interior pages (single and page .php ) but not on index.php. on index.php (home page) is fine. for example, i wanted the loop to populate an unordered lists line items, so i went about it like this: ``` ...
Add `wp_reset_query();` after your loop to prevent other loops on the page (for example, the navigation) to break. ``` <?php query_posts( array ( 'category_name' => 'left_sidebar', 'posts_per_page' => 4, 'orderby=menu_order' ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li><a href="<?ph...
84,345
<p>I'm using <strong><a href="http://wordpress.org/extend/plugins/pods/" rel="nofollow noreferrer">Pods plugin</a></strong> <em>(ver 2.2)</em> to create some <strong>'Pods'</strong> or <strong>Advanced Content Types</strong>, as they would refer to it, which are like <em>custom post types</em> but are actually separate...
[ { "answer_id": 84458, "author": "Scott Kingsley Clark", "author_id": 296, "author_profile": "https://wordpress.stackexchange.com/users/296", "pm_score": 3, "selected": true, "text": "<p>To customize which fields are shown in Pods UI, you can filter the default UI options through this fil...
2013/02/03
[ "https://wordpress.stackexchange.com/questions/84345", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1044/" ]
I'm using **[Pods plugin](http://wordpress.org/extend/plugins/pods/)** *(ver 2.2)* to create some **'Pods'** or **Advanced Content Types**, as they would refer to it, which are like *custom post types* but are actually separate from WP, blank slate, in their own tables. Each content type has at least two fields. What ...
To customize which fields are shown in Pods UI, you can filter the default UI options through this filter / function combination. Overriding the $ui array with the options you wish to customize, this can be pretty quick and easy. ``` function pods_ui_test ( $ui ) { // Test on UI Column $ui[ 'fields' ][ 'manage...
84,347
<p>Im working with a project where i want the wp_nav_menu to output other css classes for current_page, current_ancestor and remove other stuff like page-id and menu-id.</p> <p>I have get some stuff working like remove the unessesary classes and id:s using a custom Walker. But i cant get the current_ancestor to change...
[ { "answer_id": 84458, "author": "Scott Kingsley Clark", "author_id": 296, "author_profile": "https://wordpress.stackexchange.com/users/296", "pm_score": 3, "selected": true, "text": "<p>To customize which fields are shown in Pods UI, you can filter the default UI options through this fil...
2013/02/03
[ "https://wordpress.stackexchange.com/questions/84347", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16722/" ]
Im working with a project where i want the wp\_nav\_menu to output other css classes for current\_page, current\_ancestor and remove other stuff like page-id and menu-id. I have get some stuff working like remove the unessesary classes and id:s using a custom Walker. But i cant get the current\_ancestor to change to a...
To customize which fields are shown in Pods UI, you can filter the default UI options through this filter / function combination. Overriding the $ui array with the options you wish to customize, this can be pretty quick and easy. ``` function pods_ui_test ( $ui ) { // Test on UI Column $ui[ 'fields' ][ 'manage...
84,352
<p>How can i retrive the categories from a post_type that i select.</p> <p>I have a Custom_field - categorie_serial </p> <pre><code>&lt;?php $values = get_field('categorie_serial'); if($values) { echo '&lt;ul&gt;'; foreach($values as $value) { echo '&lt;li&gt;' . $value . '&lt;/li&gt;'; } ...
[ { "answer_id": 84356, "author": "Marc Wiest", "author_id": 14008, "author_profile": "https://wordpress.stackexchange.com/users/14008", "pm_score": 3, "selected": true, "text": "<p>This should get you started</p>\n\n<pre><code>function my_cpt_cats() {\n $parent = get_term_by( 'slug', g...
2013/02/03
[ "https://wordpress.stackexchange.com/questions/84352", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17885/" ]
How can i retrive the categories from a post\_type that i select. I have a Custom\_field - categorie\_serial ``` <?php $values = get_field('categorie_serial'); if($values) { echo '<ul>'; foreach($values as $value) { echo '<li>' . $value . '</li>'; } echo '</ul>'; } // always good to s...
This should get you started ``` function my_cpt_cats() { $parent = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $args = array( 'type' => 'post', 'child_of' => $parent->term_id, 'parent' => '', ...
84,407
<p>I have two WP sites. I want to reach from one of them, into the other, and retrieve specific featured images for posts, and display them with a link to that post. </p> <p>I am using this line (with the correct info for my target database): </p> <pre><code>$mydb = new wpdb('username','password','database','localho...
[ { "answer_id": 84509, "author": "Jordi Cabot", "author_id": 7592, "author_profile": "https://wordpress.stackexchange.com/users/7592", "pm_score": 0, "selected": false, "text": "<p>To get the featured image of a post (e.g. the post 1885 in your example) you need to check in the wp_postmet...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84407", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26964/" ]
I have two WP sites. I want to reach from one of them, into the other, and retrieve specific featured images for posts, and display them with a link to that post. I am using this line (with the correct info for my target database): ``` $mydb = new wpdb('username','password','database','localhost'); ``` What would...
Whenever I'm trying to link two sites, I find the most efficient and least destructive way is to use the WordPress XMLRPC API. <http://codex.wordpress.org/XML-RPC_WordPress_API/Posts> In this case, you could pull this info through using the built in IXR\_Client library. This saves a ton of time writing code and trying...
84,417
<p>My site has Genesis framework and a child theme. I want to show specific category posts on my home page content area. I used the simple post query</p> <pre><code>query_posts(‘post_status=publish&amp;cat=33&amp;wp_get_recent_posts()’); </code></pre> <p>in my <code>genesis/lib/structure/loops.php</code> file right a...
[ { "answer_id": 94905, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 2, "selected": false, "text": "<p>Also using <code>query_posts()</code> is highly discouraged. If you need a second loop, use <code>new WP...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84417", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26973/" ]
My site has Genesis framework and a child theme. I want to show specific category posts on my home page content area. I used the simple post query ``` query_posts(‘post_status=publish&cat=33&wp_get_recent_posts()’); ``` in my `genesis/lib/structure/loops.php` file right above the `do_action( ‘genesis_before_post’ );...
Also using `query_posts()` is highly discouraged. If you need a second loop, use `new WP_Query()` or if you want to adjust the main loop then use [`pre_get_posts`](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_categories_on_your_main_page). If you home page is not a static page, then this...
84,426
<p>I'm building a cinema site, I came with a problem, let me explain:</p> <ul> <li>Movies- are stored in Post's </li> <li>Actors- are stored in Post Type - persoane ( taxonomy= lista)</li> <li>Serials - are stored in Post Type - serial ( taxonomy= seriale)</li> </ul> <p>I use Advance Custom Field to link the Person t...
[ { "answer_id": 94905, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 2, "selected": false, "text": "<p>Also using <code>query_posts()</code> is highly discouraged. If you need a second loop, use <code>new WP...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84426", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17885/" ]
I'm building a cinema site, I came with a problem, let me explain: * Movies- are stored in Post's * Actors- are stored in Post Type - persoane ( taxonomy= lista) * Serials - are stored in Post Type - serial ( taxonomy= seriale) I use Advance Custom Field to link the Person to the movie - ![enter image description h...
Also using `query_posts()` is highly discouraged. If you need a second loop, use `new WP_Query()` or if you want to adjust the main loop then use [`pre_get_posts`](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_categories_on_your_main_page). If you home page is not a static page, then this...
84,450
<p>I am working on building some shortcodes for my blog. I can set a single parameter for my shortcode, but not sure how to set different parameter.</p> <p>For example, I can use <code>[myshortcode myvalue]</code> to output a html block within the post content.</p> <p>Here is what I am currently using: </p> <pre><c...
[ { "answer_id": 84451, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>If you use the shortcode like that <code>atts[0]</code> will contain the value:</p>\n\n<pre><code>add_shortcode( 'test...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84450", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26991/" ]
I am working on building some shortcodes for my blog. I can set a single parameter for my shortcode, but not sure how to set different parameter. For example, I can use `[myshortcode myvalue]` to output a html block within the post content. Here is what I am currently using: ``` function test_shortcodes( $atts ) { ...
Lets look at the shortcode ``` [SH_TEST var1="somevalue" var2="someothervalue"]THE SHORTCODE CONTENT[/SH_TEST] ``` the shortcode handler function accepts 3 paramters 1. `$atts` - an array of attributes passed by the shortcode in our case: * `$atts['var1']` is set to `'somevalue'` * `$atts['var2']` is set to `'s...
84,457
<p>I used a tutorial I found for a slick little custom gallery in 3.4, but upon upgrade to 3.5 it no longer works. I'm trying to learn php still and can't seem to get this working again, as I either get errors or nothing at all. Anyway, prior to the upgrade all the user had to do was hit "Add media", upload whatever im...
[ { "answer_id": 84460, "author": "david.binda", "author_id": 14022, "author_profile": "https://wordpress.stackexchange.com/users/14022", "pm_score": -1, "selected": false, "text": "<p>Man, it seems that the error is not in any of those codes. I've insertet them (the first one to to single...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84457", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26992/" ]
I used a tutorial I found for a slick little custom gallery in 3.4, but upon upgrade to 3.5 it no longer works. I'm trying to learn php still and can't seem to get this working again, as I either get errors or nothing at all. Anyway, prior to the upgrade all the user had to do was hit "Add media", upload whatever image...
I guess you were sorta correct, @david.binda, lol! After a lot of reading, and experimenting, I added the code below to the else statement in my functions file, and it appears to be working as it did before, although the process seems a lot "bulkier" with the new gallery trying to do it's thing. ``` $...
84,461
<p>How can I change the post limit for taxonomy.php from that which is defined in the settings page?</p> <p>Currently I have 10 posts displaying per page, which is fine for the blog part of my site, but I want to show all posts when the user is on taxonomy.php, is there a function that can achieve this?</p>
[ { "answer_id": 84463, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>Use the <code>pre_get_posts</code> hook to check is you are in a taxonomy term archive and change the number o...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84461", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18547/" ]
How can I change the post limit for taxonomy.php from that which is defined in the settings page? Currently I have 10 posts displaying per page, which is fine for the blog part of my site, but I want to show all posts when the user is on taxonomy.php, is there a function that can achieve this?
Use the `pre_get_posts` hook to check is you are in a taxonomy term archive and change the number of posts ex: ``` add_action('pre_get_posts', 'change_tax_num_of_posts' ); function change_tax_num_of_posts( $wp_query ) { if( is_tax() && is_main_query()) { $wp_query->set('posts_per_page', 5); } } ```
84,479
<p>I am using this plugin: <a href="http://wordpress.org/extend/plugins/worldcurrency/" rel="nofollow">http://wordpress.org/extend/plugins/worldcurrency/</a></p> <p>Shortcode syntax: </p> <pre><code>[worldcurrency cur="EUR" value="25"] </code></pre> <p>However, I'm using Advanced custom fields and the shortcode for...
[ { "answer_id": 84481, "author": "Greg Turner", "author_id": 9986, "author_profile": "https://wordpress.stackexchange.com/users/9986", "pm_score": 0, "selected": false, "text": "<p>My answer involves changing the coding of world currency plugin.<br>\nThen write the shortcode like this:</p...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84479", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23634/" ]
I am using this plugin: <http://wordpress.org/extend/plugins/worldcurrency/> Shortcode syntax: ``` [worldcurrency cur="EUR" value="25"] ``` However, I'm using Advanced custom fields and the shortcode for custom fields is not being executed within the shortcode for worldcurrency. ``` [worldcurrency curr="[acf fie...
I haven't tried this, but you could try [pseudo-changing the priority of your shortcode hook](http://www.viper007bond.com/2009/11/22/wordpress-code-earlier-shortcodes/). Basically, you force your shortcode to execute before it would normally. That link shows how to execute your shortcode separately - and, more importa...
84,486
<p>I've written a simple Wordpress plugin to create a new database table. The new table ought to be created when the plugin is activated. When I try to activate the plugin, I get the following error:</p> <pre><code>The plugin generated 3989 characters of unexpected output during activation. If you notice “headers alre...
[ { "answer_id": 84491, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 3, "selected": true, "text": "<p><code>$wpdb</code> is outside the scope of your plugin file, you need <code>global $wpdb;</code> before using <code>...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84486", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26999/" ]
I've written a simple Wordpress plugin to create a new database table. The new table ought to be created when the plugin is activated. When I try to activate the plugin, I get the following error: ``` The plugin generated 3989 characters of unexpected output during activation. If you notice “headers already sent” mess...
`$wpdb` is outside the scope of your plugin file, you need `global $wpdb;` before using `$wpdb->prefix`
84,497
<p>To optimise the speed of my platform (beyond caching, database optimisation, JPEG compression, CSS sprites etc), it has come to my attention that disabling the <code>wptexturize()</code> function may give some minor results.</p> <p>We can disable this function by using <a href="https://gist.github.com/982554" rel=...
[ { "answer_id": 84499, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": true, "text": "<p><code>wptexturize()</code> (in <code>wp-includes/formatting.php</code>) tries to convert typewriter quotes <code>\"</co...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84497", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24875/" ]
To optimise the speed of my platform (beyond caching, database optimisation, JPEG compression, CSS sprites etc), it has come to my attention that disabling the `wptexturize()` function may give some minor results. We can disable this function by using [this](https://gist.github.com/982554) script (written by our own "...
`wptexturize()` (in `wp-includes/formatting.php`) tries to convert typewriter quotes `"` and `'` into typographically correct pendants like “ or «, depending on current translation files. If you cannot type correct quotes, you should not disable it. There are some related replacements for dashes and ellipsis (*not* l...
84,501
<p>I just setup W3 Total Cache S3 CDN (origin push) and most of the URLs are being rewritten correctly but we have some custom plugins where the URLs are not being rewritten. How do I grab the rewritten URL of W3TC from another plugin? I'm currently using the following code to grab the image:</p> <p><code>wp_get_att...
[ { "answer_id": 86953, "author": "Dak", "author_id": 27494, "author_profile": "https://wordpress.stackexchange.com/users/27494", "pm_score": 0, "selected": false, "text": "<p>I had the same issues and couldn't get an answer either. I did however find where in the database WP is storing th...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84501", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23259/" ]
I just setup W3 Total Cache S3 CDN (origin push) and most of the URLs are being rewritten correctly but we have some custom plugins where the URLs are not being rewritten. How do I grab the rewritten URL of W3TC from another plugin? I'm currently using the following code to grab the image: `wp_get_attachment_image_src...
The W3 Total Cache plugin changes the URL of various files in */w3-total-cache/lib/W3/Plugin/Cdn.php* in the function \*ob\_callback\*. It uses a series of callbacks to modify an output buffer. The code runs like this: * w3\_total\_cache.php calls `$root->run();` * W3\_Root::run calls `$plugin->run()` for each plugin ...
84,520
<p>There might be an answer here somewhere, but I'm unable to find it, or recognize it if I did. Here's the situation:</p> <p>I have a custom post type, 'region', that displays on single-region.php. Region names are North, South, East, West. </p> <p>I have another custom post type, 'news'. Associated with it is a cus...
[ { "answer_id": 86953, "author": "Dak", "author_id": 27494, "author_profile": "https://wordpress.stackexchange.com/users/27494", "pm_score": 0, "selected": false, "text": "<p>I had the same issues and couldn't get an answer either. I did however find where in the database WP is storing th...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84520", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/30/" ]
There might be an answer here somewhere, but I'm unable to find it, or recognize it if I did. Here's the situation: I have a custom post type, 'region', that displays on single-region.php. Region names are North, South, East, West. I have another custom post type, 'news'. Associated with it is a custom field named '...
The W3 Total Cache plugin changes the URL of various files in */w3-total-cache/lib/W3/Plugin/Cdn.php* in the function \*ob\_callback\*. It uses a series of callbacks to modify an output buffer. The code runs like this: * w3\_total\_cache.php calls `$root->run();` * W3\_Root::run calls `$plugin->run()` for each plugin ...
84,521
<p>I'm working on translating a site from HTML/CSS to Wordpress, and I've come across an issue. In the spirit of keeping the site fully customizable from the dashboard, I've been using Wordpress' default menu system for creating my navigation, but I can't get it to do what it would in hard coded HTML. I need to move th...
[ { "answer_id": 86953, "author": "Dak", "author_id": 27494, "author_profile": "https://wordpress.stackexchange.com/users/27494", "pm_score": 0, "selected": false, "text": "<p>I had the same issues and couldn't get an answer either. I did however find where in the database WP is storing th...
2013/02/04
[ "https://wordpress.stackexchange.com/questions/84521", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27008/" ]
I'm working on translating a site from HTML/CSS to Wordpress, and I've come across an issue. In the spirit of keeping the site fully customizable from the dashboard, I've been using Wordpress' default menu system for creating my navigation, but I can't get it to do what it would in hard coded HTML. I need to move the p...
The W3 Total Cache plugin changes the URL of various files in */w3-total-cache/lib/W3/Plugin/Cdn.php* in the function \*ob\_callback\*. It uses a series of callbacks to modify an output buffer. The code runs like this: * w3\_total\_cache.php calls `$root->run();` * W3\_Root::run calls `$plugin->run()` for each plugin ...
84,537
<p>I am trying to create a single.php file for a specific category on my site. Instead of loading the single.php file I want WP to return that category in a file called single-category-53.php (the actual category id=53). I allow the selection of multiple categories on the site, and with the help of Hikari's permalink p...
[ { "answer_id": 84539, "author": "Marc Wiest", "author_id": 14008, "author_profile": "https://wordpress.stackexchange.com/users/14008", "pm_score": 0, "selected": false, "text": "<p>Don't know why you need it done that way, but if the way doesn't matter too much to you. Here's what I woul...
2013/02/05
[ "https://wordpress.stackexchange.com/questions/84537", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26934/" ]
I am trying to create a single.php file for a specific category on my site. Instead of loading the single.php file I want WP to return that category in a file called single-category-53.php (the actual category id=53). I allow the selection of multiple categories on the site, and with the help of Hikari's permalink plug...
I think this does what you want: ``` function ag_templates( $template = '' ){ global $post; $meta = get_post_meta( $post->ID, '_category_permalink', true ); if( 53 == $meta ){ $template = locate_template( array( "single-category-53.php", $template ), false ); } ...
84,547
<p>Enabling infinite scrolling is as simple as adding this snippet to the theme's functions.php file (where 'content' is the <code>id</code> of the container that wraps the posts):</p> <pre><code>add_theme_support( 'infinite-scroll', array( 'type' =&gt; 'scroll', 'container' =&gt; 'content', 'footer' =&gt;...
[ { "answer_id": 85057, "author": "david.binda", "author_id": 14022, "author_profile": "https://wordpress.stackexchange.com/users/14022", "pm_score": 2, "selected": false, "text": "<p>I've checked the source code for Slim Jetpack and this task can not be accomplished without rewriting that...
2013/02/05
[ "https://wordpress.stackexchange.com/questions/84547", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10691/" ]
Enabling infinite scrolling is as simple as adding this snippet to the theme's functions.php file (where 'content' is the `id` of the container that wraps the posts): ``` add_theme_support( 'infinite-scroll', array( 'type' => 'scroll', 'container' => 'content', 'footer' => false, ) ); ``` But what should...
In an email response, Kris Karkoski, Happiness Engineer (WordPress.com) at Automattic told me, *"Infinite Scrolling with multiple columns is not supported in Jetpack at this time."*
84,549
<p>I am trying to include categories in search results. I've been searching for hours now with no solution.</p> <p>By "including categories" I don't mean search in a certain category, I mean let's say I have a bicycle store and have many companies included in the site; a user searched for <code>BMX mountain cross</cod...
[ { "answer_id": 84570, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 0, "selected": false, "text": "<p>Obviously possible, if it works like this, I'm using <em>TwentyTwelve</em>, you have to edit <code>sear...
2013/02/05
[ "https://wordpress.stackexchange.com/questions/84549", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25617/" ]
I am trying to include categories in search results. I've been searching for hours now with no solution. By "including categories" I don't mean search in a certain category, I mean let's say I have a bicycle store and have many companies included in the site; a user searched for `BMX mountain cross` for example. It wi...
I'm using this code in my search.php above the main loop: ``` $search_term = explode( ' ', get_search_query( false ) ); global $wpdb; $select = " SELECT DISTINCT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('category')"; $first = true; fore...
84,551
<p>I've a postmeta key saved in DB: <code>mediSHOP_product_extras</code> It's value is</p> <p>Unserialized: <code>Array ( [0] =&gt; Array ( [is_slider] =&gt; 0 [is_featured] =&gt; 0 [in_stock] =&gt; 0 [video_url] =&gt; [related_product_list] =&gt; ) )</code></p> <p>For simplicity I didn't want to save each value as a...
[ { "answer_id": 84556, "author": "Arvind Pal", "author_id": 12858, "author_profile": "https://wordpress.stackexchange.com/users/12858", "pm_score": 0, "selected": false, "text": "<p>I think below code will work for you</p>\n\n<pre><code>$args = array(\n 'post_type' =&gt; 'post',\n 'me...
2013/02/05
[ "https://wordpress.stackexchange.com/questions/84551", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I've a postmeta key saved in DB: `mediSHOP_product_extras` It's value is Unserialized: `Array ( [0] => Array ( [is_slider] => 0 [is_featured] => 0 [in_stock] => 0 [video_url] => [related_product_list] => ) )` For simplicity I didn't want to save each value as a new key/value combination in DB. But I might have made a...
It is possible if you shape your meta query to look for the serialized string like this, assuming your array value is always an integer: ``` $params = array( 'meta_query' => array( array( 'key' => 'mediSHOP_product_extras', 'value' => 's:11:"is_featured";i:1;', 'co...
84,608
<p>I have 5,000 regular posts, 6,000 posts in one post type and 2,000 posts in another post type. Needless to say, that has made the <code>wp_posts</code> table quite large. Not to mention, I have custom taxonomies set up to mimic the post types so for every Company A entered into Company post type, there is Company A,...
[ { "answer_id": 84664, "author": "ellenmva", "author_id": 26475, "author_profile": "https://wordpress.stackexchange.com/users/26475", "pm_score": 1, "selected": false, "text": "<p>With both Nextgen Gallery and Nextgen-Galleryview active, the shortcode <code>[nggallery id=1 template=\"gall...
2013/02/05
[ "https://wordpress.stackexchange.com/questions/84608", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1697/" ]
I have 5,000 regular posts, 6,000 posts in one post type and 2,000 posts in another post type. Needless to say, that has made the `wp_posts` table quite large. Not to mention, I have custom taxonomies set up to mimic the post types so for every Company A entered into Company post type, there is Company A, I manually en...
With both Nextgen Gallery and Nextgen-Galleryview active, the shortcode `[nggallery id=1 template="galleryview"]` should work with **`1`** being your gallery ID.
84,611
<p>I am looking to override a function in functions.php through a theme or plugin. Specifically, is_ssl(), which does not have any filter or action hooks. Obviously, the easy why would be to update functions.php itself, but this will leave issues with upgrade and compatibility. How could this be done.</p> <p>Edit: ...
[ { "answer_id": 84614, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>You cannot override a function once it is defined. That is pure PHP. Some functions are wrapped in a conditio...
2013/02/05
[ "https://wordpress.stackexchange.com/questions/84611", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12388/" ]
I am looking to override a function in functions.php through a theme or plugin. Specifically, is\_ssl(), which does not have any filter or action hooks. Obviously, the easy why would be to update functions.php itself, but this will leave issues with upgrade and compatibility. How could this be done. Edit: The goal is ...
If you look at the source of the `is_ssl()` function you'll see it checks various `$_SERVER` variables. Therefore, you could try adding this to a plugin: ``` if ( isset( $_SERVER['HTTP_MY_CUSTOM_HEADER'] ) ) $_SERVER['HTTPS'] = 'on'; ``` You'd need to call that code as early as possible, ie. directly in the plugin...
84,633
<p>I have high Google Page Rank, and as a result of that, lots of spammers make trackbacks. Every day I have to delete them.</p> <p>Will those trackbacks negatively affect my site's SEO? How can I disable all trackbacks on my site?</p> <p>I have run the following code in my MySQL admin and using the WordPress Manage...
[ { "answer_id": 84658, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 2, "selected": false, "text": "<p>This can be solved using the <kbd>Bulk Edit</kbd> WordPress functionality.</p>\n\n<blockquote>\n <p><a href...
2013/02/05
[ "https://wordpress.stackexchange.com/questions/84633", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26997/" ]
I have high Google Page Rank, and as a result of that, lots of spammers make trackbacks. Every day I have to delete them. Will those trackbacks negatively affect my site's SEO? How can I disable all trackbacks on my site? I have run the following code in my MySQL admin and using the WordPress Manage DB plugin, but it...
This can be solved using the `Bulk Edit` WordPress functionality. > > [![bulk edit](https://i.stack.imgur.com/zQ2yH.png)](https://i.stack.imgur.com/zQ2yH.png) > > > and > > [![editing bulk edit](https://i.stack.imgur.com/uUCRG.png)](https://i.stack.imgur.com/uUCRG.png) > > > Change the number of items to be...
84,660
<p>I want to check if current page match at least one of two conditions. I don't want to show js code into about page and into 404 page. For the rest of my pages i show the js code. So, I use <code>((!is_page(element1) AND !is_page(element2))</code> then show the js code. Element1 is a slug of one specific page and el...
[ { "answer_id": 84661, "author": "Simon", "author_id": 9458, "author_profile": "https://wordpress.stackexchange.com/users/9458", "pm_score": 3, "selected": true, "text": "<p>I think this would do : </p>\n\n<pre><code>if ( is_page( 'element1.php' ) || is_404() ) {\n// do that if page is u...
2013/02/05
[ "https://wordpress.stackexchange.com/questions/84660", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16911/" ]
I want to check if current page match at least one of two conditions. I don't want to show js code into about page and into 404 page. For the rest of my pages i show the js code. So, I use `((!is_page(element1) AND !is_page(element2))` then show the js code. Element1 is a slug of one specific page and element2 is 404.p...
I think this would do : ``` if ( is_page( 'element1.php' ) || is_404() ) { // do that if page is using template page element1.php or is 404 } ```
84,708
<p>I noticed in my home page's source code:</p> <pre><code>&lt;meta property="og:description" content="This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to pote...
[ { "answer_id": 84709, "author": "Jamie", "author_id": 14761, "author_profile": "https://wordpress.stackexchange.com/users/14761", "pm_score": 0, "selected": false, "text": "<p>that looks like the text from the sample page that all WordPress installs come with. Have you checked there? </p...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84708", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13981/" ]
I noticed in my home page's source code: ``` <meta property="og:description" content="This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visito...
That's a FaceBook plugin most likely using the output of the `post excerpt` - via `get_the_excerpt()` or whatever - to populate the `og:description` meta tag. It's placed there automatically by the plugin.
84,717
<p>I was able to get this working just fine with this code with advanced custom fields:</p> <pre><code>&lt;?php $value = get_field('extended_store_descriptions', stores_47); echo $value; ?&gt; </code></pre> <p>Now how can I make that number 47 dynamic and automatically generate based on the category id.</p> <p>I tri...
[ { "answer_id": 84733, "author": "bboy", "author_id": 16702, "author_profile": "https://wordpress.stackexchange.com/users/16702", "pm_score": 0, "selected": false, "text": "<p>I'm not 100% sure what you want to achieve, but hope this helps (works for me):</p>\n\n<pre><code>&lt;?php $cat_i...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84717", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27076/" ]
I was able to get this working just fine with this code with advanced custom fields: ``` <?php $value = get_field('extended_store_descriptions', stores_47); echo $value; ?> ``` Now how can I make that number 47 dynamic and automatically generate based on the category id. I tried doing this ``` <?php $storenum = ge...
What is `stores_47` exactly? A variable name? Shouldn't it be `$stores_47` instead? I don't understand what you want to do here, but I think you're looking for [variable variables](http://php.net/manual/en/language.variables.variable.php). Try this: ``` <?php $cat_id = 47; $value = get_field('extended_store_descript...
84,721
<p>I'm wondering if there is any way to use get_template_part() with folders? My main folder has a lot of files now because I put every re-usable element in a separate file. I'd like to put them in folders then.</p> <p>There is no information about that in Codex: <a href="http://codex.wordpress.org/Function_Reference/...
[ { "answer_id": 84723, "author": "Mike Madern", "author_id": 24806, "author_profile": "https://wordpress.stackexchange.com/users/24806", "pm_score": 1, "selected": false, "text": "<p>The notes of function <code>get_template_part()</code> says:</p>\n\n<blockquote>\n <p><strong>Notes</stro...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84721", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17167/" ]
I'm wondering if there is any way to use get\_template\_part() with folders? My main folder has a lot of files now because I put every re-usable element in a separate file. I'd like to put them in folders then. There is no information about that in Codex: <http://codex.wordpress.org/Function_Reference/get_template_par...
In fact you can, I have a folder in my theme directory called `/partials/` in in that folder I have files such as `latest-articles.php`, `latest-news.php` and `latest-statements.php` and I load these files using `get_template_part()` like: ``` get_template_part('partials/latest', 'news'); get_template_part('partials/...
84,732
<p>The question is asked many times in different forms, but can't find my answer from <a href="https://www.google.com.bd/search?q=how+to+transfer+wordpress.com+blog+to+personal+hosting+exactly&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla%3aen-US%3aofficial&amp;client=firefox-a#hl=en&amp;client=firefox-a&amp;h...
[ { "answer_id": 84740, "author": "Christian Rios", "author_id": 26364, "author_profile": "https://wordpress.stackexchange.com/users/26364", "pm_score": 0, "selected": false, "text": "<p>When exporting content from WordPress.com, you should be given the option to:</p>\n\n<p><code>Download ...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84732", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22728/" ]
The question is asked many times in different forms, but can't find my answer from [any of 'em](https://www.google.com.bd/search?q=how+to+transfer+wordpress.com+blog+to+personal+hosting+exactly&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla%3aen-US%3aofficial&client=firefox-a#hl=en&client=firefox-a&hs=Cih&tbo=d&rls=org.mozilla...
"*Moving to .org*" means "*moving from WordPress.com blog provider to your own installation of WordPress which you can download from wordpress.org*" - just to clear out your first point. And than, after you export all data from your wordpress.com account, while importing them to your local install, you're asked to aut...
84,735
<p>I'm having a little problem with a wordpress installation. Basically, I have two servers: <code>test.dev</code> and <code>staging.dev</code>.</p> <p>Set up (using the hosts file) and I've just copied the <code>test.dev</code> WordPress installation over to the staging server. Works brilliant on my computer but on s...
[ { "answer_id": 84737, "author": "andy", "author_id": 27079, "author_profile": "https://wordpress.stackexchange.com/users/27079", "pm_score": 0, "selected": false, "text": "<p>It would appear this setting is for some reason stored in the database. I just ran this query:</p>\n\n<pre><code>...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84735", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27079/" ]
I'm having a little problem with a wordpress installation. Basically, I have two servers: `test.dev` and `staging.dev`. Set up (using the hosts file) and I've just copied the `test.dev` WordPress installation over to the staging server. Works brilliant on my computer but on someone who doesn't have `test.dev` none of ...
Caching is not your problem here. The home URL and site URL are stored in the `wp_options` table in your database. You can update them either by visiting the *Settings > General* page in your WordPress dashboard, or you can edit the `siteurl` and `home` option values directly in the database through an SQL query or a c...
84,743
<p>Im creating a plugin with the following structure:</p> <blockquote> <pre><code>plugins (folder) - myplugin (folder) - myplugin_index.php (adminpanel file) - myplugin_ajax.php (loading data when user enters a form on the "start page") themes (folder) - mytheme (folder) - template_my_own.php (this file have the...
[ { "answer_id": 84744, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 2, "selected": false, "text": "<h2>How plugins loading works</h2>\n\n<p>WordPress has, as any other software, a specific order in which files get loa...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84743", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25672/" ]
Im creating a plugin with the following structure: > > > ``` > plugins (folder) > - myplugin (folder) > - myplugin_index.php (adminpanel file) > - myplugin_ajax.php (loading data when user enters a form on the "start page") > > themes (folder) > - mytheme (folder) > - template_my_own.php (this file have the fo...
How plugins loading works ------------------------- WordPress has, as any other software, a specific order in which files get loaded. During loading WPs core files, there're specific points where you can either hook into `do_action()` or alter data during `apply_filters()` calls. Those functions always get called with...
84,794
<p>If you have an <code>index.php</code> with a loop such as:</p> <pre><code>if(have_posts()){ while(have_posts()){ the_post(); } } </code></pre> <p>And nothing is returned, you would generally do a:</p> <pre><code>if(have_posts()){ while(have_posts()){ the_post(); } }else{ //disp...
[ { "answer_id": 84796, "author": "Alex", "author_id": 10923, "author_profile": "https://wordpress.stackexchange.com/users/10923", "pm_score": 2, "selected": false, "text": "<p>Checkout the WordPress Template Hierarchy page, in particular the diagram: <a href=\"http://codex.wordpress.org/T...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84794", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27670/" ]
If you have an `index.php` with a loop such as: ``` if(have_posts()){ while(have_posts()){ the_post(); } } ``` And nothing is returned, you would generally do a: ``` if(have_posts()){ while(have_posts()){ the_post(); } }else{ //display message } ``` However, what if you have a ...
If you want to force the `404.php` template to load if there are no found posts, use the `template_include` filter: ``` function wpa84794_template_check( $template ) { global $wp_query; if ( 0 == $wp_query->found_posts ){ $template = locate_template( array( '404.php', $template ), ...
84,795
<p>I have in my blog around 2k+ posts in 15 categories and around 1k tags. The problem now is that the website I bought the theme from decided to upgrade/update their themes infrastructure and now I need to export my normal posts into a custom post type. Ill explain below.</p> <p>To be able to use their portofolio gri...
[ { "answer_id": 84796, "author": "Alex", "author_id": 10923, "author_profile": "https://wordpress.stackexchange.com/users/10923", "pm_score": 2, "selected": false, "text": "<p>Checkout the WordPress Template Hierarchy page, in particular the diagram: <a href=\"http://codex.wordpress.org/T...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84795", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17284/" ]
I have in my blog around 2k+ posts in 15 categories and around 1k tags. The problem now is that the website I bought the theme from decided to upgrade/update their themes infrastructure and now I need to export my normal posts into a custom post type. Ill explain below. To be able to use their portofolio grid template...
If you want to force the `404.php` template to load if there are no found posts, use the `template_include` filter: ``` function wpa84794_template_check( $template ) { global $wp_query; if ( 0 == $wp_query->found_posts ){ $template = locate_template( array( '404.php', $template ), ...
84,799
<p>Hopefully I can explain this correctly, as I'm getting confused myself now with what I want to achieve!</p> <p>I have two Custom Post Types, "Students" &amp; "Boats"</p> <p>In "students" I have the Taxonomy "Classes" and then Taxonomy Terms of; "Class of 2012", "Class of 2011" etc. etc.</p> <p>In "boats" I have t...
[ { "answer_id": 84796, "author": "Alex", "author_id": 10923, "author_profile": "https://wordpress.stackexchange.com/users/10923", "pm_score": 2, "selected": false, "text": "<p>Checkout the WordPress Template Hierarchy page, in particular the diagram: <a href=\"http://codex.wordpress.org/T...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84799", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27099/" ]
Hopefully I can explain this correctly, as I'm getting confused myself now with what I want to achieve! I have two Custom Post Types, "Students" & "Boats" In "students" I have the Taxonomy "Classes" and then Taxonomy Terms of; "Class of 2012", "Class of 2011" etc. etc. In "boats" I have the Taxonomy "Projects" and t...
If you want to force the `404.php` template to load if there are no found posts, use the `template_include` filter: ``` function wpa84794_template_check( $template ) { global $wp_query; if ( 0 == $wp_query->found_posts ){ $template = locate_template( array( '404.php', $template ), ...
84,802
<p>Maybe it's a stupid question but I can't find the answer. </p> <p>I have a custom taxonomy (directores) and each director is a term. Some times a film has more than one director. I need to print only the first director no all directors from one film.</p> <p>Thanks!!!</p>
[ { "answer_id": 84813, "author": "Aina-Lluna Taylor", "author_id": 24456, "author_profile": "https://wordpress.stackexchange.com/users/24456", "pm_score": 3, "selected": false, "text": "<p>Finally I read the Wordpress doc <a href=\"http://codex.wordpress.org/Function_Reference/get_terms\"...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84802", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24456/" ]
Maybe it's a stupid question but I can't find the answer. I have a custom taxonomy (directores) and each director is a term. Some times a film has more than one director. I need to print only the first director no all directors from one film. Thanks!!!
Finally I read the Wordpress doc [Reference/get terms](http://codex.wordpress.org/Function_Reference/get_terms) ``` $args = array('number' => '1',); $terms = get_terms('director', $args ); foreach( $terms as $term ){ echo $term->name ; } ```
84,806
<p>I need to create an ul list in a Custom Meta Box.</p> <p>The content/text area of the post is already taken up with other information.</p> <p>Is it possible to create another text area like WP built in one so I could us the Unordered list button.</p> <p>-- EDIT --</p> <p>I'm not sure how else I can describe this...
[ { "answer_id": 84811, "author": "Jonathan Wold", "author_id": 1766, "author_profile": "https://wordpress.stackexchange.com/users/1766", "pm_score": 0, "selected": false, "text": "<p>You can create \"Custom Fields\" that allow you to add additional information to your post, stored as \"po...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84806", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17373/" ]
I need to create an ul list in a Custom Meta Box. The content/text area of the post is already taken up with other information. Is it possible to create another text area like WP built in one so I could us the Unordered list button. -- EDIT -- I'm not sure how else I can describe this. I know how to create Custom...
You can add your information in regular metabox textarea and separate prospective list items with new line. Then just format it as list in your template: ``` <?php $list_items = get_post_meta($post->ID, 'your_custom_field_name', true); if($list_items){ $list_items = explode("\n", $list_items) ...
84,816
<p>Hey everyone on Stackexchange!</p> <p>I'm trying to find a way to prioritize posts based on a category in a loop, which is sorted by dates. All posts are grouped under their respective dates. The date labels appear once on top of posts of the same date like this:</p> <p>Date</p> <ul> <li>Post1</li> <li>Post2</li>...
[ { "answer_id": 84811, "author": "Jonathan Wold", "author_id": 1766, "author_profile": "https://wordpress.stackexchange.com/users/1766", "pm_score": 0, "selected": false, "text": "<p>You can create \"Custom Fields\" that allow you to add additional information to your post, stored as \"po...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84816", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27104/" ]
Hey everyone on Stackexchange! I'm trying to find a way to prioritize posts based on a category in a loop, which is sorted by dates. All posts are grouped under their respective dates. The date labels appear once on top of posts of the same date like this: Date * Post1 * Post2 * Post3 Date before that * Post 4 * P...
You can add your information in regular metabox textarea and separate prospective list items with new line. Then just format it as list in your template: ``` <?php $list_items = get_post_meta($post->ID, 'your_custom_field_name', true); if($list_items){ $list_items = explode("\n", $list_items) ...
84,827
<p>I have been trying to output content of all post-types (Posts, Pages and CPTs) based on a term of a custom taxonomy that they <strong>must</strong> share (meaning if they don't share that particular term, the output should not include that post-type).</p> <p>Here is what I have so far:</p> <pre><code>$term_list = ...
[ { "answer_id": 84843, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 0, "selected": false, "text": "<p>You might try the slugs instead of the names, i.e.</p>\n\n<pre><code>$term_list = wp_get_post_terms($post-&gt;...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84827", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I have been trying to output content of all post-types (Posts, Pages and CPTs) based on a term of a custom taxonomy that they **must** share (meaning if they don't share that particular term, the output should not include that post-type). Here is what I have so far: ``` $term_list = wp_get_post_terms($post->ID, 'pers...
we meet here again :) Try using this: ``` $term_list = wp_get_post_terms( $post->ID, 'persons', array( 'fields' => 'ids' ) ); ``` and ``` 'tax_query' => array( array( 'taxonomy' => 'persons', 'field' => 'id', 'terms' => $term_list ) ), ``` AFAIK, the `tax_query` acce...
84,852
<p>I have a (relatively) tricky situation where my code requires changing the loop output every three posts, and within those three posts there are divs around two of the posts.</p> <p>The code below displays 6 posts and I would want to loop though a total of 24 posts, repeating this four times.</p> <p>Can anyone hel...
[ { "answer_id": 84865, "author": "Joshua Richards", "author_id": 25328, "author_profile": "https://wordpress.stackexchange.com/users/25328", "pm_score": 0, "selected": false, "text": "<p>I think this would work:</p>\n\n<pre><code>&lt;?php \n$counter = 1;\nif ( have_posts() ) : while ( hav...
2013/02/06
[ "https://wordpress.stackexchange.com/questions/84852", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13663/" ]
I have a (relatively) tricky situation where my code requires changing the loop output every three posts, and within those three posts there are divs around two of the posts. The code below displays 6 posts and I would want to loop though a total of 24 posts, repeating this four times. Can anyone help? Thanks! **FIR...
You can do this with much less code, using the `modulo` operator. The modulo sign in PHP is `%`, and works like this: it gives you the remainder of a division, for example ``` 5 % 2 = 1 9 % 3 = 0 11 % 7 = 4 ``` So your code would look like this (I think you have a typo in your question, in the "First Three" the sec...
84,880
<p>I am working on a Wordpress theme that has a homepage slider. I have a table in Wordpress database that stores post view counts and I would like to make my slider show the top viewed posts.</p> <p>This is the SQL to get the top post, Post ID's</p> <pre><code>SELECT `post_id`, `single_views` FROM `wp_ak_popularity...
[ { "answer_id": 84867, "author": "Morgan Kay", "author_id": 16808, "author_profile": "https://wordpress.stackexchange.com/users/16808", "pm_score": 0, "selected": false, "text": "<p>What kind of updates are you talking about?</p>\n\n<p>Your understanding is basically correct: if you make ...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84880", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8668/" ]
I am working on a Wordpress theme that has a homepage slider. I have a table in Wordpress database that stores post view counts and I would like to make my slider show the top viewed posts. This is the SQL to get the top post, Post ID's ``` SELECT `post_id`, `single_views` FROM `wp_ak_popularity` ORDER BY `single_vie...
You can enable child themes for any theme: <http://codex.wordpress.org/Child_Themes> If you want your parent theme based off another parent theme, for example you want a theme based off of *Twitter bootstrap* and apply any changes they make to your framework, without over-riding your changes, use revision control. [...
84,886
<p>Sorry if this has been asked before, but I couldn't find any reference to this here.</p> <p>Looking at a plugin's stats on the WordPress site, you can see a percentage of versions of your plugin being used. Do you know of a way of getting the total number of users? That would be the 100% of the pie chart ;)</p> <p...
[ { "answer_id": 84889, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 0, "selected": false, "text": "<p>WordPress.org does not keep stats on how many active users a plugin has. You can only get the number of downloads...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84886", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/298/" ]
Sorry if this has been asked before, but I couldn't find any reference to this here. Looking at a plugin's stats on the WordPress site, you can see a percentage of versions of your plugin being used. Do you know of a way of getting the total number of users? That would be the 100% of the pie chart ;) From what I coul...
I do not think that this is possible. This numbers are only calculated by which Version has been downloaded (+1 to the absolute Download statistics) and if an Update changed the Version (-1 to the former and +1 to the current, used for the percentage). I am not really sure about the second part, but it has to be some...
84,920
<p>Just wondering is it possible to add HTML code after the fisrt widget in a sidebar so that it would only show once and not repeat after a second or third widget is added? </p> <p>This is what I have so far: </p> <pre><code> if (function_exists('register_sidebar')) { register_sidebar(array( 'id' =&gt; 'sid...
[ { "answer_id": 84924, "author": "jose pacheco", "author_id": 26884, "author_profile": "https://wordpress.stackexchange.com/users/26884", "pm_score": 0, "selected": false, "text": "<p>Just do a different first widget? or im getting badly what you need?!</p>\n" }, { "answer_id": 85...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84920", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19826/" ]
Just wondering is it possible to add HTML code after the fisrt widget in a sidebar so that it would only show once and not repeat after a second or third widget is added? This is what I have so far: ``` if (function_exists('register_sidebar')) { register_sidebar(array( 'id' => 'sidebar2', 'name' => __...
Register separate sidebar for the first widget and add requred HTML between sidebars in template file(s). ``` <?php dynamic_sidebar('First Widget Sidebar'); ?> <div class"content">Here only once</div> <?php dynamic_sidebar('Other Widgets Sidebar'); ?> ```
84,921
<p>I need to grab any posts using a custom taxonomy.</p> <pre><code>$args = array( 'post_type' =&gt; 'adverts', 'advert_tag' =&gt; 'politics' // Doesn't seem to work. ); query_posts($args); while ( have_posts() ) : the_post(); //Show Posts endwhile; </code></pre> <p>Taxonomy Declaration:</p> <pre><code>a...
[ { "answer_id": 84923, "author": "Eugene Manuilov", "author_id": 8170, "author_profile": "https://wordpress.stackexchange.com/users/8170", "pm_score": 7, "selected": true, "text": "<p>Firs of all <strong>don't use <code>query_posts()</code> ever</strong>, read more about it here: <a href=...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84921", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27138/" ]
I need to grab any posts using a custom taxonomy. ``` $args = array( 'post_type' => 'adverts', 'advert_tag' => 'politics' // Doesn't seem to work. ); query_posts($args); while ( have_posts() ) : the_post(); //Show Posts endwhile; ``` Taxonomy Declaration: ``` add_action( 'init', 'add_custom_taxonomy'...
Firs of all **don't use `query_posts()` ever**, read more about it here: [When should you use WP\_Query vs query\_posts() vs get\_posts()?](https://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts). You have to use `WP_Query` to fetch posts what you need. Read [docume...
84,922
<p>I am hoping that someone can shed light on this problem I am trying to solve, even if simply changing my thought process as to how I could solve this.</p> <p>I am importing a custom CakePHP based CMS web application into WordPress by means of traversing the database, making numerous SQL queries, building arrays and...
[ { "answer_id": 85078, "author": "tobbr", "author_id": 27179, "author_profile": "https://wordpress.stackexchange.com/users/27179", "pm_score": 3, "selected": true, "text": "<p>Yes you can by programatically adding the attachment.</p>\n\n<pre><code>$upl = wp_upload_dir();\n$target = $upl['...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84922", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27136/" ]
I am hoping that someone can shed light on this problem I am trying to solve, even if simply changing my thought process as to how I could solve this. I am importing a custom CakePHP based CMS web application into WordPress by means of traversing the database, making numerous SQL queries, building arrays and finally o...
Yes you can by programatically adding the attachment. ``` $upl = wp_upload_dir(); $target = $upl['basedir'] . '/YOUR_CUSTOM_FOLDERS/YOUR_FILE'; $filetype = wp_check_filetype($target); $attachment = array( 'post_mime_type' => $filetype['type'], 'post_title' => $YOUR_FILE_TITLE, 'post_content' => '', '...
84,929
<p>I have slow upload on my wordpress server and I want to export two very big image to external server. So I need Media Library Image to use in other component. I cant edit URL of Image. Is any plugin or solution for using remote image as Media Library?</p> <p>Tnaks for help. Marcin </p>
[ { "answer_id": 85078, "author": "tobbr", "author_id": 27179, "author_profile": "https://wordpress.stackexchange.com/users/27179", "pm_score": 3, "selected": true, "text": "<p>Yes you can by programatically adding the attachment.</p>\n\n<pre><code>$upl = wp_upload_dir();\n$target = $upl['...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84929", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27141/" ]
I have slow upload on my wordpress server and I want to export two very big image to external server. So I need Media Library Image to use in other component. I cant edit URL of Image. Is any plugin or solution for using remote image as Media Library? Tnaks for help. Marcin
Yes you can by programatically adding the attachment. ``` $upl = wp_upload_dir(); $target = $upl['basedir'] . '/YOUR_CUSTOM_FOLDERS/YOUR_FILE'; $filetype = wp_check_filetype($target); $attachment = array( 'post_mime_type' => $filetype['type'], 'post_title' => $YOUR_FILE_TITLE, 'post_content' => '', '...
84,937
<p>0 down vote favorite</p> <p>I show my last post in a page with this code:</p> <pre><code>$query1 = new WP_Query(); $query1-&gt;the_post(); </code></pre> <p>and it further with:</p> <pre><code>$id = $query-&gt;ID; </code></pre> <p>to retrieve last post ID so I wrote a new wp_query and I want to exclue that ID fr...
[ { "answer_id": 84941, "author": "fischi", "author_id": 15680, "author_profile": "https://wordpress.stackexchange.com/users/15680", "pm_score": 2, "selected": false, "text": "<p>Change your <code>Query</code> to</p>\n\n<pre><code>$query2-&gt; new WP_Query( array( 'post__not_in' =&gt; arra...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84937", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14278/" ]
0 down vote favorite I show my last post in a page with this code: ``` $query1 = new WP_Query(); $query1->the_post(); ``` and it further with: ``` $id = $query->ID; ``` to retrieve last post ID so I wrote a new wp\_query and I want to exclue that ID from the results: I wrote this but it don't work: ``` $query2-...
If I'm understanding your specific question (and posted code) correctly, you're actually trying to exclude the **most recent** post from your query? If so, there's a *much* easier method: [use the `offset` parameter](http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters): ``` $query2 = new WP_Query...
84,943
<p>WordPress implements a simple order functionality by default.</p> <p>What's the common method, to retrieve the <code>menu_order</code> for the current post or page?</p>
[ { "answer_id": 84947, "author": "fischi", "author_id": 15680, "author_profile": "https://wordpress.stackexchange.com/users/15680", "pm_score": 5, "selected": true, "text": "<p>If you have the post with an <code>$id</code>:</p>\n\n<pre><code>$thispost = get_post($id);\n$menu_order = $this...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84943", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4872/" ]
WordPress implements a simple order functionality by default. What's the common method, to retrieve the `menu_order` for the current post or page?
If you have the post with an `$id`: ``` $thispost = get_post($id); $menu_order = $thispost->menu_order; ``` WordPress itself does not provide a function to get the `menu_order`, so you have to query the `post`-Object. If you are outside the loop, you can use the above function, however inside the loop you could also...
84,950
<p>I'm trying to display the first and last name of an author without having to change the "Display publicly as..." setting. Problem is, I can only seem to find solutions for either or, or at best display/nice/nickname. I would like to display the full name no matter what the user/author has chosen to "Display publicly...
[ { "answer_id": 84952, "author": "WP Themes", "author_id": 25649, "author_profile": "https://wordpress.stackexchange.com/users/25649", "pm_score": 5, "selected": true, "text": "<p>Try the following:</p>\n\n<pre><code>&lt;?php\n\n$fname = get_the_author_meta('first_name');\n$lname = get_th...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84950", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25846/" ]
I'm trying to display the first and last name of an author without having to change the "Display publicly as..." setting. Problem is, I can only seem to find solutions for either or, or at best display/nice/nickname. I would like to display the full name no matter what the user/author has chosen to "Display publicly as...
Try the following: ``` <?php $fname = get_the_author_meta('first_name'); $lname = get_the_author_meta('last_name'); $full_name = ''; if( empty($fname)){ $full_name = $lname; } elseif( empty( $lname )){ $full_name = $fname; } else { //both first name and last name are present $full_name = "{$fname} {$...
84,968
<p>is there a nice function I can use to limit logged in users to one comment per post? I'm setting up a review system and only one review permitted per user. Thanks.</p>
[ { "answer_id": 84974, "author": "AndrettiMilas", "author_id": 5205, "author_profile": "https://wordpress.stackexchange.com/users/5205", "pm_score": 2, "selected": false, "text": "<p>See if this still works:</p>\n\n<pre><code>&lt;?php\nglobal $current_user;\n$args = array('user_id' =&gt; ...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84968", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26166/" ]
is there a nice function I can use to limit logged in users to one comment per post? I'm setting up a review system and only one review permitted per user. Thanks.
``` <?php global $current_user; $args = array( 'user_id' => $current_user->ID, 'post_id' = 100, // post ID. Can be '$post->ID' depending where you are calling this from 'count' => true ); if(get_comments($args) >= 1){ echo 'disabled'; } else { comment_form(); } ``` [Function\_Reference/get\_co...
84,970
<p>With the advent of responsive design, it's beginning to simply make sense that we could make a site into an app. The concept is simple:</p> <ul> <li>When the user is on the site, remove the browser around the site so that it appears to be like any other app</li> <li>Provide the appropriately-sized icons for device...
[ { "answer_id": 84978, "author": "Kyle Krafka", "author_id": 26647, "author_profile": "https://wordpress.stackexchange.com/users/26647", "pm_score": 1, "selected": false, "text": "<ul>\n<li>How much of the browser you can hide depends on the browser you're using. This might help out:\n\n...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84970", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5205/" ]
With the advent of responsive design, it's beginning to simply make sense that we could make a site into an app. The concept is simple: * When the user is on the site, remove the browser around the site so that it appears to be like any other app * Provide the appropriately-sized icons for devices (tablets, smartphone...
The best way to do this would be to use CSS3 media quires: `@media (max-device-width: 480px)` but requires more work. The quick and dirty way to make your WordPress theme app-like would be to add the viewport meta tag to the `<head>` of your page: `<meta name="viewport" content="width=device-width, initial-scale=1,...
84,975
<p>All my enqueued styles are applied to the back-end as well. I have never encountered this behavior before.</p> <p>Here's my code:</p> <pre><code>wp_register_style( 'main-styles', get_stylesheet_directory_uri() . '/css/styles.css', false, '1.0.0', 'all'); wp_enqueue_style('main-styles'); </code></pre>
[ { "answer_id": 84976, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 4, "selected": true, "text": "<blockquote>\n <p>Why are my styles being applied to the admin area?</p>\n</blockquote>\n\n<p>Assuming that is a...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84975", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27149/" ]
All my enqueued styles are applied to the back-end as well. I have never encountered this behavior before. Here's my code: ``` wp_register_style( 'main-styles', get_stylesheet_directory_uri() . '/css/styles.css', false, '1.0.0', 'all'); wp_enqueue_style('main-styles'); ```
> > Why are my styles being applied to the admin area? > > > Assuming that is all of the code, it is because you are enqueueing the styles globally. You need to hook that to `wp_enqueue_scripts`, which will only load on the front end. ``` wp_register_style( 'main-styles', get_stylesheet_directory_uri() . '/css/st...
84,980
<p>I am having trouble of getting the ID in user_register filter in functions.php...</p> <p>Here is what I got</p> <pre><code>add_action( 'user_register', 'sendanotheremail' ); function sendanotheremail($user_id) { $user = new WP_User($user_id); $user_login = stripslashes($user-&gt;user_login); ...
[ { "answer_id": 84976, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 4, "selected": true, "text": "<blockquote>\n <p>Why are my styles being applied to the admin area?</p>\n</blockquote>\n\n<p>Assuming that is a...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84980", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27152/" ]
I am having trouble of getting the ID in user\_register filter in functions.php... Here is what I got ``` add_action( 'user_register', 'sendanotheremail' ); function sendanotheremail($user_id) { $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $user_email = stripsl...
> > Why are my styles being applied to the admin area? > > > Assuming that is all of the code, it is because you are enqueueing the styles globally. You need to hook that to `wp_enqueue_scripts`, which will only load on the front end. ``` wp_register_style( 'main-styles', get_stylesheet_directory_uri() . '/css/st...
84,992
<p>I would like to show the number of posts on the category page. How is it possible? I tried to find a solution but no luck..</p> <p>Thank you!</p>
[ { "answer_id": 84995, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 2, "selected": false, "text": "<pre><code>$category = get_the_category(); \necho $category[0]-&gt;category_count;\n</code></pre>\n\n<p>See <a ...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/84992", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25381/" ]
I would like to show the number of posts on the category page. How is it possible? I tried to find a solution but no luck.. Thank you!
If you are on a category archive you don't need to query all the posts of the category like Christopher Ross suggested and you can't use `get_the_category()` like Max Yudin suggested unless you are already in the loop. What you can do is simply get the current category object using `get_queried_object()` which will ho...
85,003
<p>I can't seem to get archive page or category page to work correctly.</p> <p>I am following <a href="http://codex.wordpress.org/Template_Hierarchy#Category_display" rel="nofollow">http://codex.wordpress.org/Template_Hierarchy#Category_display</a></p> <p>and it still defaults to archive.php ( i think, according to c...
[ { "answer_id": 85005, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": true, "text": "<p>Since you are using a custom taxonomy and not the native post categories you need to name your file <code>taxo...
2013/02/07
[ "https://wordpress.stackexchange.com/questions/85003", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7771/" ]
I can't seem to get archive page or category page to work correctly. I am following <http://codex.wordpress.org/Template_Hierarchy#Category_display> and it still defaults to archive.php ( i think, according to chart ) even though I have named it category-business.php here is my code: ``` /****************** // Bu...
Since you are using a custom taxonomy and not the native post categories you need to name your file `taxonomy-{taxonomy}.php` and in your case it would be `taxonomy-mycategories.php` Take a look at the section of the template hierarchy to [display custom taxonomy archives](http://codex.wordpress.org/Template_Hierarch...
85,044
<p>I have Woocommerce installed on a site I am prototyping. I have some Woocommerce CSS I want to change, but when I try to change it via the style.css in my Twenty Eleven child theme, nothing happens. I can make the change in Firebug no problem.</p> <p>I assume it's because the plugin CSS is being loaded after the th...
[ { "answer_id": 85047, "author": "Kayo", "author_id": 26994, "author_profile": "https://wordpress.stackexchange.com/users/26994", "pm_score": 1, "selected": false, "text": "<p>you could try being more specific:</p>\n\n<pre><code>#content .products .product{\n width: 48% !important;\n}\...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85044", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18685/" ]
I have Woocommerce installed on a site I am prototyping. I have some Woocommerce CSS I want to change, but when I try to change it via the style.css in my Twenty Eleven child theme, nothing happens. I can make the change in Firebug no problem. I assume it's because the plugin CSS is being loaded after the theme CSS. I...
You can change the CSS loading order. Find the place where WooCommerce enqueues it's CSS and keep in mind it's `$handle` (name). Search for `wp_enqueue_style`. Then go to theme's `functions.php` and find the place where your theme enqueues it's CSS. Now change your theme's `wp_enqueue_style` by adding WooCommerce's ...
85,054
<p>I want to set a special styling for the ul tags created by Tinymce only, which means only for posts and pages, I only found this filter <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference/tiny_mce_before_init" rel="nofollow">tiny_mce_before_init</a> with an example on how to add custom style options to a...
[ { "answer_id": 85056, "author": "david.binda", "author_id": 14022, "author_profile": "https://wordpress.stackexchange.com/users/14022", "pm_score": 2, "selected": false, "text": "<p>Is that really necessary? Try to modify you theme's page.php and single.php in a way it's wrapp the_conten...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85054", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14490/" ]
I want to set a special styling for the ul tags created by Tinymce only, which means only for posts and pages, I only found this filter [tiny\_mce\_before\_init](http://codex.wordpress.org/Plugin_API/Filter_Reference/tiny_mce_before_init) with an example on how to add custom style options to an existing style dropdown....
It's always a good idea to look at Wordpress Codex before asking. [TinyMCE Custom Styles](http://codex.wordpress.org/TinyMCE_Custom_Styles) ``` <?php // Insert 'styleselect' into the $buttons array function my_mce_buttons_2( $buttons ) { array_unshift( $buttons, 'styleselect' ); return $buttons; } // Use 'mce_...
85,059
<p>I need to create a user comment form with three text areas and then display them in comments. I don't know where to start - cannot find any plugin but would like to code it anyway. Any pointers much appreciated.</p>
[ { "answer_id": 85060, "author": "jose pacheco", "author_id": 26884, "author_profile": "https://wordpress.stackexchange.com/users/26884", "pm_score": 0, "selected": false, "text": "<p>3 textares for what purpose? or you meant 2 input´s and 1 texarea plus 1 input button? i would start read...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85059", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26166/" ]
I need to create a user comment form with three text areas and then display them in comments. I don't know where to start - cannot find any plugin but would like to code it anyway. Any pointers much appreciated.
To add new fields, simply append them to the default fields with a plugin. ``` <?php defined( 'ABSPATH' ) AND exit; /* Plugin Name: (#85059) Append form fields to comment form */ add_filter( 'comment_form_default_fields', 'wpse85059_comment_form_extd', 100 ); function wpse85059_comment_form_extd( $fields ) { // A...
85,069
<p>I want to make a page for each user on my website. When a user logs in, I want them to be able to click on pages that are just designed for them (basically when they log in, I want them to be able to view their own profile). When another user logs in, I want them to be able to view their own profile. </p> <p>Note: ...
[ { "answer_id": 85075, "author": "tobbr", "author_id": 27179, "author_profile": "https://wordpress.stackexchange.com/users/27179", "pm_score": 0, "selected": false, "text": "<pre><code>if ( is_user_logged_in() ) {\n // logged in\n} else {\n // not logged in\n}\n</code></pre>\n\n<p>E...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85069", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27063/" ]
I want to make a page for each user on my website. When a user logs in, I want them to be able to click on pages that are just designed for them (basically when they log in, I want them to be able to view their own profile). When another user logs in, I want them to be able to view their own profile. Note: I want the...
Based on this statement... > > note: i want their profile called MY ACCOUNT to be on the nav bar > > > ... and other parts of your description, I think what you want is not really to have pages that are "only members that are logged in". Despite the title of the questions, it sounds like you want a page that will...
85,084
<p>I want to append the URL when viewing a single post. For example when im on a post I want the url to be something like: <code>example.com/mypage/mypage/single-post-article</code> </p> <p>The default url is <code>example.com/single-post-article</code></p> <p>I did not find something here on WPSE or the goooglz, bu...
[ { "answer_id": 85327, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 4, "selected": true, "text": "<p>Go to your Settings > Permalinks page and set your permalinks to:</p>\n\n<pre><code>/mypage/mypage/%postname%/\n</co...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85084", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16722/" ]
I want to append the URL when viewing a single post. For example when im on a post I want the url to be something like: `example.com/mypage/mypage/single-post-article` The default url is `example.com/single-post-article` I did not find something here on WPSE or the goooglz, but I have read about `wp-rewrite` and tr...
Go to your Settings > Permalinks page and set your permalinks to: ``` /mypage/mypage/%postname%/ ``` If you don't want categories to append `/mypage/mypage`, you can change their permastruct: ``` function wpa85084_category_permastruct(){ global $wp_rewrite; $wp_rewrite->extra_permastructs['category']['struc...
85,091
<p>I've moved my blog from <a href="http://leghumped.com/blog" rel="nofollow">http://leghumped.com/blog</a> to <a href="http://leghumped.com/" rel="nofollow">http://leghumped.com/</a> and now I can't access my /images directory. I've tried every combination of rules from trawling for people with the same problem, but i...
[ { "answer_id": 85093, "author": "gteh", "author_id": 12963, "author_profile": "https://wordpress.stackexchange.com/users/12963", "pm_score": 1, "selected": false, "text": "<p>Comment out the following by adding hash tags before it</p>\n\n<pre><code>#RewriteCond %{REQUEST_URI} !^/images/\...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85091", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10839/" ]
I've moved my blog from <http://leghumped.com/blog> to <http://leghumped.com/> and now I can't access my /images directory. I've tried every combination of rules from trawling for people with the same problem, but it seems most of them say it "just started working". This is my root .htaccess ``` # BEGIN WordPress> Re...
Comment out the following by adding hash tags before it ``` #RewriteCond %{REQUEST_URI} !^/images/ #RewriteCond %{REQUEST_URI} !^/images #RewriteCond %{REQUEST_URI} !.*images(.*) ``` and see if that helps.
85,092
<p>I have a serialized array as a meta value and I'm trying to run WP Query where it finds a specific value in the serialized array.</p> <p>Here's an example of the serialized array field:</p> <pre><code>a:6:{i:0;s:3:"173";i:1;s:3:"172";i:2;s:3:"171";i:3... </code></pre> <p>Here's my query, but it doesn't work: The ...
[ { "answer_id": 85095, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>You can't use <code>LIKE</code> with <code>numeric</code> (at least I am pretty sure you can't). <code>numeri...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85092", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4432/" ]
I have a serialized array as a meta value and I'm trying to run WP Query where it finds a specific value in the serialized array. Here's an example of the serialized array field: ``` a:6:{i:0;s:3:"173";i:1;s:3:"172";i:2;s:3:"171";i:3... ``` Here's my query, but it doesn't work: The ID's are numberic I'm doing a sea...
I came across this same issue today. In both our situations, there is in fact a nice solution. Because the serialized data we are searching for, are simply IDs, and they are always wrapped in quotations, we just need to include the quotations as part of the query. This eliminates the problem of encountering false posit...
85,096
<p>I am trying to find reference for comment_post to insert custom data to custom table when comment post.</p> <p>I want to insert below things to my custom table</p> <ol> <li>Comment's Post ID </li> <li>Custom content (which will done with custom query)</li> </ol> <p>Can anyone please help me to do this?</p>
[ { "answer_id": 85102, "author": "tobbr", "author_id": 27179, "author_profile": "https://wordpress.stackexchange.com/users/27179", "pm_score": 2, "selected": false, "text": "<p>Not sure what you're after but this is how you would get the content of a newly posted comment</p>\n\n<pre><code...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85096", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9821/" ]
I am trying to find reference for comment\_post to insert custom data to custom table when comment post. I want to insert below things to my custom table 1. Comment's Post ID 2. Custom content (which will done with custom query) Can anyone please help me to do this?
Not sure what you're after but this is how you would get the content of a newly posted comment ``` add_action( 'comment_post', 'my_comment_callback' ); function my_comment_callback($id) { $comment = get_comments(array( 'ID' => $id )); // $content is the actual text the user posted $content = $...
85,107
<p>My question is partly based on this answer: <a href="https://wordpress.stackexchange.com/a/5778/27135">https://wordpress.stackexchange.com/a/5778/27135</a></p> <p>Mike's answer is really great, and the solution worked fine until I needed to include my meta box in a custom post type. I tried to alter the code until ...
[ { "answer_id": 85152, "author": "jevets", "author_id": 12339, "author_profile": "https://wordpress.stackexchange.com/users/12339", "pm_score": 1, "selected": false, "text": "<p>The <code>save_post</code> action will call your function and send it the $post_id, not $data and $postarr.</p>...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85107", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27135/" ]
My question is partly based on this answer: <https://wordpress.stackexchange.com/a/5778/27135> Mike's answer is really great, and the solution worked fine until I needed to include my meta box in a custom post type. I tried to alter the code until that worked, but I did not succeed. I also do not need more than one se...
I believe this is what you were looking for. I moved back to using a class because what you were using would very easily conflict with someone else's code who decided to use the function names `select_box_add_meta_box()`, `select_box_content()` and/or `select_box_save_postdata()`, which is reasonably likely. The class...
85,108
<p>I need public users to be able to submit posts, then have them be approved by a moderator or admin on the dashboard. Is this possible to do? I would like it to function very similarly to comments.</p> <p>for example, users will post their own stories and then a moderator will approve it being posted.</p> <p>I am n...
[ { "answer_id": 85115, "author": "helgatheviking", "author_id": 6477, "author_profile": "https://wordpress.stackexchange.com/users/6477", "pm_score": 0, "selected": false, "text": "<p>The only plugin that I know of that supports this is <a href=\"http://www.gravityforms.com/\" rel=\"nofol...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85108", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27169/" ]
I need public users to be able to submit posts, then have them be approved by a moderator or admin on the dashboard. Is this possible to do? I would like it to function very similarly to comments. for example, users will post their own stories and then a moderator will approve it being posted. I am new to this partic...
If you don't want to give users access to the WordPress admin screens and you don't want to use a premium plugin, you should create a form in a page and use [wp\_insert\_post](http://codex.wordpress.org/Function_Reference/wp_insert_post) with the submitted data. In your case, the "post\_status" parameter could be used...
85,120
<p>I'm having a problem displaying filtered category list pages. I want to be able to only show the current category, not all of the posts from "my categories". i.e. www...com/mycategories/category-3/ would only show posts in category page. Here is what I have but it seems to display all the categories in the <code>tax...
[ { "answer_id": 85121, "author": "Genxer", "author_id": 25951, "author_profile": "https://wordpress.stackexchange.com/users/25951", "pm_score": 1, "selected": false, "text": "<p>Use the following code:</p>\n\n<pre><code>&lt;?php\nif (have_posts()):\n while (have_posts()):\n the_...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85120", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7771/" ]
I'm having a problem displaying filtered category list pages. I want to be able to only show the current category, not all of the posts from "my categories". i.e. www...com/mycategories/category-3/ would only show posts in category page. Here is what I have but it seems to display all the categories in the `taxonomy-my...
Use the following code: ``` <?php if (have_posts()): while (have_posts()): the_post(); ?> <h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5> <?php if ($content != 'no') { the_excerpt(); } endwhile; endif; ?> ```
85,125
<p>Since updating to 3.5.1, I can no longer get single line breaks in the WYSIWYG editor. I used to be able to shift-return for a line break and return for a paragraph break. But now all lines have double spacing. Hitting "delete" at the beginning of the line does not help.</p> <p>I can of course fix this by switch...
[ { "answer_id": 85129, "author": "J. Chin", "author_id": 27207, "author_profile": "https://wordpress.stackexchange.com/users/27207", "pm_score": 1, "selected": false, "text": "<p>A \"workaround\" that I found which made it work for me today is to add:</p>\n\n<pre><code>define( 'CONCATENAT...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85125", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23610/" ]
Since updating to 3.5.1, I can no longer get single line breaks in the WYSIWYG editor. I used to be able to shift-return for a line break and return for a paragraph break. But now all lines have double spacing. Hitting "delete" at the beginning of the line does not help. I can of course fix this by switching out of WY...
A "workaround" that I found which made it work for me today is to add: ``` define( 'CONCATENATE_SCRIPTS', false ); ``` to the end of wp-config.php
85,134
<p>Is it possible to change the default status of every new page created to be "unpublished"?</p> <p>We want to have someone help us add pages to a site, but not have them show up by default until it is (all of the pages) approved to go live.</p> <p>Suggestions would be greatly appreciated.</p>
[ { "answer_id": 85141, "author": "montrealist", "author_id": 8105, "author_profile": "https://wordpress.stackexchange.com/users/8105", "pm_score": -1, "selected": false, "text": "<p>When you're creating a new page, there are two buttons available in the 'publish' metabox: '<strong>Save Dr...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85134", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27207/" ]
Is it possible to change the default status of every new page created to be "unpublished"? We want to have someone help us add pages to a site, but not have them show up by default until it is (all of the pages) approved to go live. Suggestions would be greatly appreciated.
There is a very easy solution to your problem. Just add a capability to the particular role of this user, through the [Wp\_Role](http://phpdoc.wordpress.org/trunk/WordPress/User/WP_Role.html) class. Wordpress has this feature of **Submitting for Review** active for authors and contributor by default, but, if you want t...
85,140
<p>If I look at </p> <pre><code>/wp-admin/users.php </code></pre> <p>I see all the users, but some have given a bogus email and never used their password. </p> <p>Is there some way to see who has used their password at least once? If not, is there a plugin to do this going forward?</p>
[ { "answer_id": 85148, "author": "edelwater", "author_id": 576, "author_profile": "https://wordpress.stackexchange.com/users/576", "pm_score": 2, "selected": true, "text": "<h2>If you install the following plugin and leave that one running for a while... you can see who logged in since us...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85140", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13407/" ]
If I look at ``` /wp-admin/users.php ``` I see all the users, but some have given a bogus email and never used their password. Is there some way to see who has used their password at least once? If not, is there a plugin to do this going forward?
If you install the following plugin and leave that one running for a while... you can see who logged in since using that plugin: -------------------------------------------------------------------------------------------------------------------------------- <http://wordpress.org/extend/plugins/wp-last-login/> ![enter...
85,153
<p>Trying to fix my custom gallery after the 3.5 upgrade, and using the code below I'm trying to get the first image of the gallery in "large" size above the content output followed by the remaining images in the corresponding gallery in "thumbnail" size...but 'numberposts' => 1 isn't liking what I'm doing for some rea...
[ { "answer_id": 85148, "author": "edelwater", "author_id": 576, "author_profile": "https://wordpress.stackexchange.com/users/576", "pm_score": 2, "selected": true, "text": "<h2>If you install the following plugin and leave that one running for a while... you can see who logged in since us...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85153", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26992/" ]
Trying to fix my custom gallery after the 3.5 upgrade, and using the code below I'm trying to get the first image of the gallery in "large" size above the content output followed by the remaining images in the corresponding gallery in "thumbnail" size...but 'numberposts' => 1 isn't liking what I'm doing for some reason...
If you install the following plugin and leave that one running for a while... you can see who logged in since using that plugin: -------------------------------------------------------------------------------------------------------------------------------- <http://wordpress.org/extend/plugins/wp-last-login/> ![enter...
85,159
<p>I am trying to make a shortcode that will create a dynamic dropdown list of downloadable file links, that once selected, html will show a download link below the dropdown.</p> <p>Here is the end result of how the shortcode will function: <a href="http://jsfiddle.net/KKyE9/" rel="nofollow">http://jsfiddle.net/KKyE9/...
[ { "answer_id": 85158, "author": "Travis Pflanz", "author_id": 14558, "author_profile": "https://wordpress.stackexchange.com/users/14558", "pm_score": 2, "selected": false, "text": "<p>I have seen this before. It was caused by a permalink saving error, in my case.</p>\n\n<p>Go to Settings...
2013/02/08
[ "https://wordpress.stackexchange.com/questions/85159", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16641/" ]
I am trying to make a shortcode that will create a dynamic dropdown list of downloadable file links, that once selected, html will show a download link below the dropdown. Here is the end result of how the shortcode will function: <http://jsfiddle.net/KKyE9/> I am struggling with how to turn the shortcode array into ...
I have seen this before. It was caused by a permalink saving error, in my case. Go to Settings >> Permalinks. Select a different permalink option than the one you're currently using. Click "Save Changes" Select the permalink structure you want to use. Click "Save Changes" That fixed it when I encountered the same s...
85,165
<p>I stack since a few hours now and I'm sure that this is not so complicated. I would like to get all custom post types into this</p> <pre><code>$posts = query_posts( $query_string.'post_type=POST-TYPE1,POST-TYPE2,POST-TYPE3&amp;post_status=publish&amp;posts_per_page=-1&amp;' ); </code></pre> <p>I know that there i...
[ { "answer_id": 85197, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 2, "selected": false, "text": "<p>Following code generates the array to use as argument.</p>\n\n<pre><code>&lt;?php\n// Excluded CPTs. You can...
2013/02/09
[ "https://wordpress.stackexchange.com/questions/85165", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10436/" ]
I stack since a few hours now and I'm sure that this is not so complicated. I would like to get all custom post types into this ``` $posts = query_posts( $query_string.'post_type=POST-TYPE1,POST-TYPE2,POST-TYPE3&post_status=publish&posts_per_page=-1&' ); ``` I know that there is this function: `$post_types=get_post...
Following code generates the array to use as argument. ``` <?php // Excluded CPTs. You can expand the list. $exclude_cpts = array( 'portfolio' ); // Builtin types needed. $builtin = array( 'post', 'page', 'attachment' ); // All CPTs. $cpts = get_post_types( array( 'public' => true, '_builtin'...
85,171
<p>Does anyone know of a way to force a logged in user to re-login after say 4 hours? or at a particular time to day?</p> <p>For example, if they logged in at 9am, can we force them to re-login at 1pm?</p>
[ { "answer_id": 85190, "author": "Max Yudin", "author_id": 11761, "author_profile": "https://wordpress.stackexchange.com/users/11761", "pm_score": 1, "selected": false, "text": "<p>You can write <em>javascript</em> which will start on <code>wp_login</code> action, count <code>4x60x60</cod...
2013/02/09
[ "https://wordpress.stackexchange.com/questions/85171", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27207/" ]
Does anyone know of a way to force a logged in user to re-login after say 4 hours? or at a particular time to day? For example, if they logged in at 9am, can we force them to re-login at 1pm?
The easiest way is to change the authentication cookie expiry time. ``` add_filter('auth_cookie_expiration', 'wase_85171_expiry',10,3); function wase_85171_expiry($expiry, $user_id, $remember) { return 14400; // or calculate the time remaining till the time you want it to expire } ``` People can extend the cookie...
85,185
<p>I am trying to use pre_get_posts to exclude categories from posting to the homepage. If I do it like so it works just fine</p> <pre><code> $query-&gt;set( 'cat', '-13,-7,-19,-12,-24,-21,-14'); </code></pre> <p>that is hard coded in. I am building a custom admin that lists the categories in the admin menu. So now I...
[ { "answer_id": 85191, "author": "david.binda", "author_id": 14022, "author_profile": "https://wordpress.stackexchange.com/users/14022", "pm_score": 1, "selected": true, "text": "<p>try to implode $category with \",\" as a glue. Mentioned code in each foreach run rewtites the cat variable...
2013/02/09
[ "https://wordpress.stackexchange.com/questions/85185", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14761/" ]
I am trying to use pre\_get\_posts to exclude categories from posting to the homepage. If I do it like so it works just fine ``` $query->set( 'cat', '-13,-7,-19,-12,-24,-21,-14'); ``` that is hard coded in. I am building a custom admin that lists the categories in the admin menu. So now I want to use the id's that ...
try to implode $category with "," as a glue. Mentioned code in each foreach run rewtites the cat variable of $query. ``` $query->set('cat', implode(',', $category)); ```
85,214
<p>I am creating an author.php page and listing all the posts from an author. Although admins can see the posts' edit links i want to echo the link if logged in user is the current user</p> <p>for example</p> <p>if testuser is logged in and current page is /author/testuser he can see edit post links </p> <p>but</p> ...
[ { "answer_id": 85219, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>Placed in your theme's <code>functions.php</code> this should globally alter the behavior of <a href=\"http:/...
2013/02/09
[ "https://wordpress.stackexchange.com/questions/85214", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18335/" ]
I am creating an author.php page and listing all the posts from an author. Although admins can see the posts' edit links i want to echo the link if logged in user is the current user for example if testuser is logged in and current page is /author/testuser he can see edit post links but if testuser is logged in an...
If you just have to modify the author.php page, this piece of code will probably work : ``` <?php if( is_user_logged_in() && is_author(get_current_user_id()) ) { edit_post_link('edit', '', ''); } ?> ``` The first part of the conditions checks if there is a user logged. The second one will be true if the cur...
85,254
<p>I was hoping to do all of this within the category.php template, with help from the functions.php if needed.</p> <p>If my setup is:</p> <pre><code>Parent 1 --Child 1 --Child 2 Parent 2 --Child 3 --Child 4 Parent 3 --Child 5 --Child 6 </code></pre> <p>...and so on I would like to be able to do this:</p> <p>If I w...
[ { "answer_id": 85219, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>Placed in your theme's <code>functions.php</code> this should globally alter the behavior of <a href=\"http:/...
2013/02/10
[ "https://wordpress.stackexchange.com/questions/85254", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9264/" ]
I was hoping to do all of this within the category.php template, with help from the functions.php if needed. If my setup is: ``` Parent 1 --Child 1 --Child 2 Parent 2 --Child 3 --Child 4 Parent 3 --Child 5 --Child 6 ``` ...and so on I would like to be able to do this: If I was viewing Parent 1 (or 2/3), it would s...
If you just have to modify the author.php page, this piece of code will probably work : ``` <?php if( is_user_logged_in() && is_author(get_current_user_id()) ) { edit_post_link('edit', '', ''); } ?> ``` The first part of the conditions checks if there is a user logged. The second one will be true if the cur...
85,256
<p>I am trying to do a simple query to get the latest 5 posts into an unordered list, but this is only showing 1 result even though I have several posts. I even did an offset, but it shows the next post yet still 1 result. What am I doing wrong?</p> <pre><code>&lt;ul&gt; &lt;?php $the_query = new WP_Query('showpos...
[ { "answer_id": 85257, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 3, "selected": true, "text": "<p><code>the_content_limit</code> does not exist in WordPress. You probably want something like <a href=\"htt...
2013/02/10
[ "https://wordpress.stackexchange.com/questions/85256", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18935/" ]
I am trying to do a simple query to get the latest 5 posts into an unordered list, but this is only showing 1 result even though I have several posts. I even did an offset, but it shows the next post yet still 1 result. What am I doing wrong? ``` <ul> <?php $the_query = new WP_Query('showposts=5'); ?> <?php wh...
`the_content_limit` does not exist in WordPress. You probably want something like [`the_excerpt`](http://codex.wordpress.org/Function_Reference/the_excerpt). What's likely happening is your loop is working fine, but the call to an undefined function causes the program to error out, making it appear the the loop is not...
85,262
<p>I am attempting to learn PHP by creating a relatively simple application built on wordpress, it is a basic CRM and I've made decent progress but have been stuck on some of the finer points.</p> <p>I've been having some serious 'headers already sent' problems with getting wp_redirect() working after a user creates a...
[ { "answer_id": 85257, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 3, "selected": true, "text": "<p><code>the_content_limit</code> does not exist in WordPress. You probably want something like <a href=\"htt...
2013/02/10
[ "https://wordpress.stackexchange.com/questions/85262", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23396/" ]
I am attempting to learn PHP by creating a relatively simple application built on wordpress, it is a basic CRM and I've made decent progress but have been stuck on some of the finer points. I've been having some serious 'headers already sent' problems with getting wp\_redirect() working after a user creates a new cust...
`the_content_limit` does not exist in WordPress. You probably want something like [`the_excerpt`](http://codex.wordpress.org/Function_Reference/the_excerpt). What's likely happening is your loop is working fine, but the call to an undefined function causes the program to error out, making it appear the the loop is not...
85,288
<p>Gravatar is slowing my website and I want to host mystery man on my main server. So this is my normal gravatar mystery man</p> <pre><code>&lt;img class="avatar avatar-68 avatar-default" width="68" height="68" alt="avatar" style="width: 68px; height: 68px;" src="http://1.gravatar.com/avatar/b759acf051d7e8b32049b6527...
[ { "answer_id": 85291, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": false, "text": "<p>Your code actually works, it is just that you can't do what you want.</p>\n\n<p>The way gravatar works is ...
2013/02/10
[ "https://wordpress.stackexchange.com/questions/85288", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25257/" ]
Gravatar is slowing my website and I want to host mystery man on my main server. So this is my normal gravatar mystery man ``` <img class="avatar avatar-68 avatar-default" width="68" height="68" alt="avatar" style="width: 68px; height: 68px;" src="http://1.gravatar.com/avatar/b759acf051d7e8b32049b6527ac13485?s=68&d=ht...
Your code actually works, it is just that you can't do what you want. The way gravatar works is by serving the image if it has one and redirecting to the supplied default if it doesn't, so even if the default is on your server you still can't avoid the redirect. And gravatar really makes your site load faster 1. ma...
85,312
<p>I was looking for a way to remove the TinyMCE Editor for a specific page template in a theme (in my case it's page-home.php). I found the following code, which works, however, I was wondering if this could be accomplished in a better/neater way, perhaps using some of WordPress' built-in functions for finding the ID ...
[ { "answer_id": 85323, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 1, "selected": false, "text": "<p>You can try to hook on <code>load-page</code> hook instead of <code>admin_init</code>. It is supposed to b...
2013/02/10
[ "https://wordpress.stackexchange.com/questions/85312", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20636/" ]
I was looking for a way to remove the TinyMCE Editor for a specific page template in a theme (in my case it's page-home.php). I found the following code, which works, however, I was wondering if this could be accomplished in a better/neater way, perhaps using some of WordPress' built-in functions for finding the ID of ...
You can try to hook on `load-page` hook instead of `admin_init`. It is supposed to be called only when a page is being edited, and then you should be able to use the global `$post` variable ``` function hide_editor() { global $post; $template_file = get_post_meta($post->ID, '_wp_page_template', true); if($...
85,343
<p>I have the following code in my functions.php file with a call in the header, but nothing is being outputted in the html. There are no stylesheets.</p> <p>I have tried that add action wp_enque_styles with and without the s (style)</p> <pre><code>&lt;?php function scripts_and_styles() { if (!is_admin()) { // n...
[ { "answer_id": 85352, "author": "Androliyah", "author_id": 17636, "author_profile": "https://wordpress.stackexchange.com/users/17636", "pm_score": 1, "selected": false, "text": "<pre><code>&lt;?php\nfunction scripts_and_styles() {\n if (!is_admin()) {\n // normalize\n wp_register_st...
2013/02/11
[ "https://wordpress.stackexchange.com/questions/85343", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7653/" ]
I have the following code in my functions.php file with a call in the header, but nothing is being outputted in the html. There are no stylesheets. I have tried that add action wp\_enque\_styles with and without the s (style) ``` <?php function scripts_and_styles() { if (!is_admin()) { // normalize wp_registe...
``` <?php function scripts_and_styles() { if (!is_admin()) { // normalize wp_register_style( 'normal-stylesheet', 'http://necolas.github.com/normalize.css/2.1.0/normalize.css'); // register main stylesheet wp_register_style( 'main-stylesheet', get_stylesheet_directory_uri() . '/css/style.css', array(), ''...
85,361
<p>I have googled but must not be using the correct terms. I am trying to add a script to my WordPress plugin that takes a url and returns a reformatted image. I know this is frowned upon as hotlinking. The image in my case is supplied by a website imaging service. </p> <p>The image takes from 3 to 5 seconds to be...
[ { "answer_id": 85364, "author": "david.binda", "author_id": 14022, "author_profile": "https://wordpress.stackexchange.com/users/14022", "pm_score": -1, "selected": false, "text": "<p>That's because you do not have default WordPress with all it's functions loaded. You'll have to prepend t...
2013/02/11
[ "https://wordpress.stackexchange.com/questions/85361", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26526/" ]
I have googled but must not be using the correct terms. I am trying to add a script to my WordPress plugin that takes a url and returns a reformatted image. I know this is frowned upon as hotlinking. The image in my case is supplied by a website imaging service. The image takes from 3 to 5 seconds to be generated. I ...
> > Fatal error: Call to undefined function \_\_() in > /homepages/5/d367772185/htdocs/rodandfly/wp-admin/includes/file.php on > line 13 > > > Where is your code? file.php is expecting `__()` to be defined which it should be if your loading it from within an activated plugin. The best way to do what your trying...
85,367
<p>I have a custom tag-like taxonomy called PEOPLE registered to all post types - both the default and custom ones.</p> <p>I have created a template for a single term named taxonomy-people.php and I'm intending to use it to describe a specific term and query each post type for instances of that term.</p> <p>I have al...
[ { "answer_id": 85369, "author": "SeeBeen", "author_id": 18269, "author_profile": "https://wordpress.stackexchange.com/users/18269", "pm_score": -1, "selected": false, "text": "<p>Don't use WP_Query, use query_posts instead to modify the query.</p>\n\n<p>WP_Query overrides everything.</p>...
2013/02/11
[ "https://wordpress.stackexchange.com/questions/85367", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21224/" ]
I have a custom tag-like taxonomy called PEOPLE registered to all post types - both the default and custom ones. I have created a template for a single term named taxonomy-people.php and I'm intending to use it to describe a specific term and query each post type for instances of that term. I have almost managed to d...
Your code, when working, will consume sooo much resources. When implemented in this way - throught custom page template, WordPress will call for a content of that page (1 query) and after that it will call a query for each custom post type - another 4 queries. That's a lot, really. I would suggest you to take the adva...