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
70,946
<p>As of now my uploaded files are organized by year and month. But I would like to organize them by year, month and day. I mean like this <code>2012/10/30/image goes here</code></p> <p>PS: There is a <a href="http://wordpress.org/extend/plugins/custom-upload-dir/screenshots/" rel="noreferrer">plugin available</a> t...
[ { "answer_id": 71079, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 3, "selected": true, "text": "<p>Code based in other <a href=\"https://wordpress.stackexchange.com/a/53895/12615\">Answer of mine</a> and this...
2012/10/30
[ "https://wordpress.stackexchange.com/questions/70946", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5074/" ]
As of now my uploaded files are organized by year and month. But I would like to organize them by year, month and day. I mean like this `2012/10/30/image goes here` PS: There is a [plugin available](http://wordpress.org/extend/plugins/custom-upload-dir/screenshots/) to do this. But I don't want to use a plugin for thi...
Code based in other [Answer of mine](https://wordpress.stackexchange.com/a/53895/12615) and this [SO Answer](https://stackoverflow.com/a/5489779/1287812). It uses the post/page/cpt publish date to build the paths. Note that `$the_post->post_date_gmt` is also available. ``` add_filter('wp_handle_upload_prefilter', ...
70,959
<p>I'm looking over internet for some simple solution of email subscription widget but no luck.</p> <p>Or they are too complicated and paid, or they are relaying on some external email functions.</p> <p>I'm not a WordPress expert but know few things about WordPress.</p> <p>I would like to make form in widget where u...
[ { "answer_id": 70962, "author": "dipali", "author_id": 20711, "author_profile": "https://wordpress.stackexchange.com/users/20711", "pm_score": 0, "selected": false, "text": "<p>Try this plugin<br />By using this plugin users can subscribe from anywhere in your site. <a href=\"http://word...
2012/10/30
[ "https://wordpress.stackexchange.com/questions/70959", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21135/" ]
I'm looking over internet for some simple solution of email subscription widget but no luck. Or they are too complicated and paid, or they are relaying on some external email functions. I'm not a WordPress expert but know few things about WordPress. I would like to make form in widget where user enter their email ad...
This is what you're looking for: <http://codex.wordpress.org/Plugin_API/Action_Reference/init> Example from Codex: ``` add_action('init', 'process_post'); function process_post(){ if(isset($_POST['unique_hidden_field'])) { // process $_POST data here } } ```
70,960
<pre><code>&lt;?php /* * * The default template for displaying content. Used for both single and index/archive/search. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?&gt; &lt;article id="post-&lt;?php the_ID(); ?&gt;" &lt;?php post_class(); ?&gt;&gt; &lt;?php i...
[ { "answer_id": 70963, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 0, "selected": false, "text": "<p>Simply wrap this inside an <code>if</code> statement:</p>\n\n<pre><code>&lt;?php\nif ( ( is_home() OR is_front_page...
2012/10/30
[ "https://wordpress.stackexchange.com/questions/70960", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15326/" ]
``` <?php /* * * The default template for displaying content. Used for both single and index/archive/search. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php if ( is_sticky() && is_home() && ! ...
If you don't want to modify the template files directly, you could always make use of the `post_thumbnail_html` filter: ``` function wpse70960_filter_post_thumbnail_html( $html ) { if ( ( is_home() || is_single() ) { return ''; } else { return $html; } } add_filter( 'post_thumbnail_html', '...
70,976
<p>I am doing a survey using the plugin "Contact Form 7". I want to insert an acceptance box. ONLY if people check this box and click "submit", they should be redirected to another page, where I am going to ask for their e-Mail-addresses.</p> <p>If they don't check "acceptance" there should be no redirecting. </p> <...
[ { "answer_id": 71011, "author": "Roman", "author_id": 18658, "author_profile": "https://wordpress.stackexchange.com/users/18658", "pm_score": 1, "selected": false, "text": "<p>Maybee this helps:</p>\n\n<p><a href=\"http://drzaus.com/snippet/wordpress-is-contact-form-7-missing-on_submit-c...
2012/10/30
[ "https://wordpress.stackexchange.com/questions/70976", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22821/" ]
I am doing a survey using the plugin "Contact Form 7". I want to insert an acceptance box. ONLY if people check this box and click "submit", they should be redirected to another page, where I am going to ask for their e-Mail-addresses. If they don't check "acceptance" there should be no redirecting. How can I do thi...
I found an answer myself: Redirecting without a condition When you use the Wordpress plugin “Contact Form 7” you can redirect the user to another page after submitting the answers by the follwing code: ``` on_sent_ok: "location.replace('http://www.redirectedpage.com');" ``` The line of code you have to copy into t...
70,985
<p>I have a custom post type "packages" with a taxonomy "Celebrations" that has a few terms in it.</p> <p>When I try to add a link to my wp nav menu through <strong>Appearance > Menus</strong> and choosing the term I want from the Celebrations meta box, the item shows up red with a title "(Invalid)".</p> <p>See here ...
[ { "answer_id": 184553, "author": "Lucas Gabriel", "author_id": 27812, "author_profile": "https://wordpress.stackexchange.com/users/27812", "pm_score": 2, "selected": false, "text": "<p>Yeah I found the answer an another website. Taxonomies have a restriction that they cannot have upperca...
2012/10/30
[ "https://wordpress.stackexchange.com/questions/70985", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12055/" ]
I have a custom post type "packages" with a taxonomy "Celebrations" that has a few terms in it. When I try to add a link to my wp nav menu through **Appearance > Menus** and choosing the term I want from the Celebrations meta box, the item shows up red with a title "(Invalid)". See here for what I'm seeing: <http://s...
Yeah I found the answer an another website. Taxonomies have a restriction that they cannot have uppercase characters in their name they can only have lowercase and underscore characters. that`s the problem.
70,990
<p>I'd really like to take all of my old posts, and automatically use the meta descriptions we have written – currently done for each post using All In One SEO Pack – and copy them to also be our post excerpts.</p> <p>The custom field used by AIO SEO description is <code>_aioseop_description</code>.</p> <p>Would anyo...
[ { "answer_id": 71014, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 3, "selected": true, "text": "<p><strong><em>Please</em></strong>, <strong>backup your database before running this</strong>.</p>\n\n<p>The co...
2012/10/30
[ "https://wordpress.stackexchange.com/questions/70990", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10663/" ]
I'd really like to take all of my old posts, and automatically use the meta descriptions we have written – currently done for each post using All In One SEO Pack – and copy them to also be our post excerpts. The custom field used by AIO SEO description is `_aioseop_description`. Would anyone have any idea how to acco...
***Please***, **backup your database before running this**. The code is pretty straight forward and tested in a local WordPress. The advice is just for precaution sake, as I suppose you're dealing with a live site. Copy the code into a PHP file, upload it to the plugins folder and activate. 1. On activation, it ...
71,004
<p>I'm trying to create a custom post type and I've had the same problem that's described <a href="https://wordpress.stackexchange.com/questions/37967/custom-field-being-erased-after-autosave">here</a>; my custom meta information was properly saved, when saving manually, but got lost as soon as the autosave ajax ran at...
[ { "answer_id": 71010, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>WordPress does not send the content of custom fields during autosave (just title, slug and content). That’s why the cu...
2012/10/30
[ "https://wordpress.stackexchange.com/questions/71004", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18118/" ]
I'm trying to create a custom post type and I've had the same problem that's described [here](https://wordpress.stackexchange.com/questions/37967/custom-field-being-erased-after-autosave); my custom meta information was properly saved, when saving manually, but got lost as soon as the autosave ajax ran at least once. ...
WordPress does not send the content of custom fields during autosave (just title, slug and content). That’s why the custom field content will be deleted if you try to save the data: You cannot see the difference between deleted and missing content. I would create a separate autosave function for that, because the way ...
71,015
<p>I am about to create a new plugin that fetches remote content and stores it locally for use on the WP website. I have a free plugin that does this with twitter and tweets, and I store a JSON file in the plugin directory. Some users complain that the plugin cannot write files to the folder due to permissions. </p> <...
[ { "answer_id": 71016, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 5, "selected": true, "text": "<p>Look at the table schema in <code>wp-admin/includes/schema.php</code>:</p>\n\n<pre><code>// regular blog tables\nCREATE...
2012/10/31
[ "https://wordpress.stackexchange.com/questions/71015", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13090/" ]
I am about to create a new plugin that fetches remote content and stores it locally for use on the WP website. I have a free plugin that does this with twitter and tweets, and I store a JSON file in the plugin directory. Some users complain that the plugin cannot write files to the folder due to permissions. For this...
Look at the table schema in `wp-admin/includes/schema.php`: ``` // regular blog tables CREATE TABLE $wpdb->options ( option_id bigint(20) unsigned NOT NULL auto_increment, option_name varchar(64) NOT NULL default '', option_value longtext NOT NULL, autoload varchar(20) NOT NULL default 'yes', PRIMARY KEY (o...
71,026
<p>I am using <code>wp_schedule_event</code> to hourly insert items from an rss news feed into my client's blog. Here is how I am setting it up in my functions.php:</p> <pre><code>add_action('init', function(){ $timescheduled = wp_next_scheduled('update_feed'); wp_unschedule_event($timescheduled, 'update_fee...
[ { "answer_id": 71016, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 5, "selected": true, "text": "<p>Look at the table schema in <code>wp-admin/includes/schema.php</code>:</p>\n\n<pre><code>// regular blog tables\nCREATE...
2012/10/31
[ "https://wordpress.stackexchange.com/questions/71026", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3361/" ]
I am using `wp_schedule_event` to hourly insert items from an rss news feed into my client's blog. Here is how I am setting it up in my functions.php: ``` add_action('init', function(){ $timescheduled = wp_next_scheduled('update_feed'); wp_unschedule_event($timescheduled, 'update_feed'); if (!wp_next_sc...
Look at the table schema in `wp-admin/includes/schema.php`: ``` // regular blog tables CREATE TABLE $wpdb->options ( option_id bigint(20) unsigned NOT NULL auto_increment, option_name varchar(64) NOT NULL default '', option_value longtext NOT NULL, autoload varchar(20) NOT NULL default 'yes', PRIMARY KEY (o...
71,036
<p>Why <code>wp_commentmeta</code> table does not have a composite index <code>(comment_id, meta_key)</code> by default? I believe it's the only useful index for that table, am I wrong?</p> <p>Instead, it has a strange set of indexes:</p> <pre><code>mysql&gt; show create table wp3_commentmeta; ... PRIMARY KEY (`meta...
[ { "answer_id": 71802, "author": "RolandoMySQLDBA", "author_id": 4699, "author_profile": "https://wordpress.stackexchange.com/users/4699", "pm_score": 2, "selected": false, "text": "<p>You are not limited in this case. Just create the needed composite indexes and remove any duplicate inde...
2012/10/31
[ "https://wordpress.stackexchange.com/questions/71036", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23112/" ]
Why `wp_commentmeta` table does not have a composite index `(comment_id, meta_key)` by default? I believe it's the only useful index for that table, am I wrong? Instead, it has a strange set of indexes: ``` mysql> show create table wp3_commentmeta; ... PRIMARY KEY (`meta_id`), KEY `comment_id` (`comment_id`), KEY `m...
A standard WordPress schema "sync" via `dbDelta()` will only add indexes, not drop them. Same goes for fields. We never touch the storage schema either, so it'd be the default for MySQL (which in latest versions is now InnoDB). On the face, a `comment_id_meta_key` index makes perfect sense. But when you look at how Wo...
71,051
<p>I am learning WP_query and recently ran into a problem.</p> <p>I need to do a query where i first filter trough one or more custom fields, which works great thanks to meta_query.</p> <p>However, i also need it to order by multiple custom fields.</p> <p>(Like in sql you can write "ORDER BY field ASC, field2 DESC")...
[ { "answer_id": 71057, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 1, "selected": false, "text": "<p>You should customize the query via <code>posts_orderby</code> filter</p>\n\n<p>In your template</p>\n\...
2012/10/31
[ "https://wordpress.stackexchange.com/questions/71051", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22907/" ]
I am learning WP\_query and recently ran into a problem. I need to do a query where i first filter trough one or more custom fields, which works great thanks to meta\_query. However, i also need it to order by multiple custom fields. (Like in sql you can write "ORDER BY field ASC, field2 DESC") This is what i have ...
I am sure there are more elegant solutions, but this is what i came up with and it works for now... ``` global $wpdb; $querystr = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta, $wpdb->postmeta wpostmeta2, $wpdb->postmeta wpostmeta3 WHERE wposts.ID = wpostmeta.post_id AND wposts...
71,058
<p>I want one particular category insert 12 post, but I only see some few posts.</p> <p>Just like first time first 4 post and other time other post. What can I do? </p> <p><sup><strong><em>Editor note:</strong><br> I understand the issue is showing 4 posts in the first query, and the rest (8 from 12 in total) in the...
[ { "answer_id": 71063, "author": "Eric Holmes", "author_id": 23454, "author_profile": "https://wordpress.stackexchange.com/users/23454", "pm_score": 2, "selected": false, "text": "<p>Your Query code is perfect. The problem is your arguments. <a href=\"http://codex.wordpress.org/Class_Refe...
2012/10/31
[ "https://wordpress.stackexchange.com/questions/71058", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23127/" ]
I want one particular category insert 12 post, but I only see some few posts. Just like first time first 4 post and other time other post. What can I do? ***Editor note:*** I understand the issue is showing 4 posts in the first query, and the rest (8 from 12 in total) in the second query. This is the code for t...
Your Query code is perfect. The problem is your arguments. [`showposts`](http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters) is deprecated, you should be using [`posts_per_page`](http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters) instead. It defines HOW MANY posts show up ...
71,089
<p>I need to print a specific term with its id. I get that for categories with this code:</p> <pre><code>&lt;a href="&lt;?php echo get_category_link(1); ?&gt;" title="&lt;?php echo get_cat_name(1);?&gt;"&gt;&lt;?php echo get_cat_name(1);?&gt;&lt;/a&gt; </code></pre> <p>… where 1 is the id I have to print. Is there so...
[ { "answer_id": 71090, "author": "Eric Holmes", "author_id": 23454, "author_profile": "https://wordpress.stackexchange.com/users/23454", "pm_score": 3, "selected": true, "text": "<p>Use <a href=\"http://codex.wordpress.org/Function_Reference/get_term\" rel=\"nofollow noreferrer\"><code>ge...
2012/10/31
[ "https://wordpress.stackexchange.com/questions/71089", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23136/" ]
I need to print a specific term with its id. I get that for categories with this code: ``` <a href="<?php echo get_category_link(1); ?>" title="<?php echo get_cat_name(1);?>"><?php echo get_cat_name(1);?></a> ``` … where 1 is the id I have to print. Is there something like the following? ``` <?php echo get_term_lin...
Use [`get_term()`](http://codex.wordpress.org/Function_Reference/get_term) to get the name, slug, or description: ``` $term = get_term( 1, 'taxonomy_slug' ); // Name echo $term->name; // Link echo get_term_link(1, 'taxonomy_slug'); // OR echo get_term_link( $term ); ```
71,093
<p>I recently installed the <a href="http://demo.wpzoom.com/bonpress/" rel="nofollow">bonpress</a> theme and am having trouble with the captions showing correctly. The more I try to understand how captions are supposed to work in Wordpress, the more I suspect something is not happening right with my installation.</p> ...
[ { "answer_id": 71115, "author": "Mike S.", "author_id": 23137, "author_profile": "https://wordpress.stackexchange.com/users/23137", "pm_score": 0, "selected": false, "text": "<p>I found an imperfect solution on <a href=\"http://queryposts.com/function/img_caption_shortcode/\" rel=\"nofol...
2012/10/31
[ "https://wordpress.stackexchange.com/questions/71093", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23137/" ]
I recently installed the [bonpress](http://demo.wpzoom.com/bonpress/) theme and am having trouble with the captions showing correctly. The more I try to understand how captions are supposed to work in Wordpress, the more I suspect something is not happening right with my installation. When creating a post and insertin...
Find the line `/* Remove [caption] in-line styling` in `function.php`. Comment out: ``` /* add_shortcode('wp_caption', 'fixed_img_caption_shortcode'); add_shortcode('caption', 'fixed_img_caption_shortcode'); function fixed_img_caption_shortcode($attr, $content = null) { // Allow plugins/themes to override the def...
71,127
<p>I want to list 10 last posts of author in author.php template. I used this code:</p> <pre><code>&lt;?php while (have_posts()) : the_post(); ?&gt; &lt;li&gt;&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt; &lt;?php endwhile;?&gt; </code></pre> <p>But I can see only...
[ { "answer_id": 71130, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": -1, "selected": true, "text": "<p>The easiest way would be to simply add:</p>\n\n<pre><code>global $query_string;\nquery_posts( $query_string ....
2012/10/31
[ "https://wordpress.stackexchange.com/questions/71127", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23151/" ]
I want to list 10 last posts of author in author.php template. I used this code: ``` <?php while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> <?php endwhile;?> ``` But I can see only the last post of current author. Any help?
The easiest way would be to simply add: ``` global $query_string; query_posts( $query_string . '&posts_per_page=-1' ); ``` just before your code so you get : ``` <?php global $query_string; query_posts( $query_string . '&posts_per_page=-1' ); while (have_posts()) : the_post(); ?> <li><a href="<?php the_permali...
71,133
<p>I'm wondering how it's possible to add custom post type categories as an option to add as a navigation menu item.</p> <p>What I have:</p> <pre><code>$portfolio_args = array( 'labels' =&gt; array( 'name' =&gt; 'Portfolio Items', 'singular_name' =&gt; 'Portfolio Item'), 'description' =&gt; 'A...
[ { "answer_id": 71134, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 0, "selected": false, "text": "<p>You should already see this taxonomy on the bottom left under nav-menus, it works in the default them or any theme ...
2012/10/31
[ "https://wordpress.stackexchange.com/questions/71133", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21329/" ]
I'm wondering how it's possible to add custom post type categories as an option to add as a navigation menu item. What I have: ``` $portfolio_args = array( 'labels' => array( 'name' => 'Portfolio Items', 'singular_name' => 'Portfolio Item'), 'description' => 'Allows you to build custom portfol...
If you don't see your taxonomy, check under the `Screen Options` tab in the upper-right corner of the admin window and make sure the `Show on screen` check box is ticked for that taxonomy.
71,141
<p><a href="http://chineselearnonline.com/" rel="nofollow">http://chineselearnonline.com/</a></p> <pre><code>User-agent: * Disallow: /feed/ Disallow: /trackback/ Disallow: /wp-admin/ Disallow: /wp-content/ Disallow: /wp-includes/ Disallow: /xmlrpc.php Disallow: /wp- Sitemap: http://chineselearnonline.com/sitemap.xml...
[ { "answer_id": 71144, "author": "Rachel Baker", "author_id": 8054, "author_profile": "https://wordpress.stackexchange.com/users/8054", "pm_score": 2, "selected": false, "text": "<p>If you changed your site path, the urls previously indexed by search engines are no longer valid. </p>\n\n...
2012/11/01
[ "https://wordpress.stackexchange.com/questions/71141", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
<http://chineselearnonline.com/> ``` User-agent: * Disallow: /feed/ Disallow: /trackback/ Disallow: /wp-admin/ Disallow: /wp-content/ Disallow: /wp-includes/ Disallow: /xmlrpc.php Disallow: /wp- Sitemap: http://chineselearnonline.com/sitemap.xml ``` I just changed to a new server. And my site started to not to app...
If you changed your site path, the urls previously indexed by search engines are no longer valid. Google Webmaster Tools has a change of address tool: <http://support.google.com/webmasters/bin/answer.py?hl=en&answer=83106> In general, you need to : 1. setup 301 redirects for your old urls 2. create a new sitemap 3....
71,157
<p>I've got a custom post type with a standard tag taxonomy added to it like so: <code>'taxonomies' =&gt; array('post_tag')</code>. I've added some tags to some posts of this CPT which are display on the front-end with the template tag <code>the_tags()</code> and the links it generates have this format <code>http://loc...
[ { "answer_id": 71193, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 4, "selected": true, "text": "<p>This is a bug (one that I've encountered before) and could do with a ticket in <a href=\"http://core.trac.wo...
2012/11/01
[ "https://wordpress.stackexchange.com/questions/71157", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16352/" ]
I've got a custom post type with a standard tag taxonomy added to it like so: `'taxonomies' => array('post_tag')`. I've added some tags to some posts of this CPT which are display on the front-end with the template tag `the_tags()` and the links it generates have this format `http://local.mysite.dev/tag/tag1/`. When I ...
This is a bug (one that I've encountered before) and could do with a ticket in [trac](http://core.trac.wordpress.org/) (since I never took the time to submit one!) The trouble starts with requests that set multiple `is_*` query flags as true (specifically flags that represent objects, such as single posts, pages, and ...
71,170
<p>I keep running into an issue getting the file(s) added in AJAX so that the server ajax function can process the data. How can I get the $_FILES to be passed the same as with the default action (built into form elements)?</p> <p><strong>HTML Form</strong></p> <pre><code>&lt;form id="frmImport" name="frmImport" meth...
[ { "answer_id": 71172, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 2, "selected": false, "text": "<p>I haven't tried but i think you need to add <code>FormData</code> object directly as <code>data</code>...
2012/11/01
[ "https://wordpress.stackexchange.com/questions/71170", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16045/" ]
I keep running into an issue getting the file(s) added in AJAX so that the server ajax function can process the data. How can I get the $\_FILES to be passed the same as with the default action (built into form elements)? **HTML Form** ``` <form id="frmImport" name="frmImport" method="post" enctype="multipart/form-da...
Here's the solution that I was able to find, and I actually see quite a few common mistakes that were made. * Files weren't being appended properly in JS. * AJAX `dataFilter: function()` could be replaced with `dataType: 'json'`. * JS submit doesn't need to return false to stop the form action. + Could be replace wit...
71,181
<p>I accidentally removed a bunch of plugin folders. I restored them all directly after, but since then my site is completely blank. Can't see anything, it's just white.</p> <p>I'm not sure what to do, but looking at a log file seems like a good start. Is there one?</p>
[ { "answer_id": 71182, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 4, "selected": true, "text": "<p>There's not one if you didn't set one up. The <a href=\"http://codex.wordpress.org/Editing_wp-config.php#...
2012/11/01
[ "https://wordpress.stackexchange.com/questions/71181", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22530/" ]
I accidentally removed a bunch of plugin folders. I restored them all directly after, but since then my site is completely blank. Can't see anything, it's just white. I'm not sure what to do, but looking at a log file seems like a good start. Is there one?
There's not one if you didn't set one up. The [codex](http://codex.wordpress.org/Editing_wp-config.php#Configure_Error_Log) has a good example of how to do this. ``` <?php @ini_set('log_errors','On'); @ini_set('display_errors','Off'); @ini_set('error_log','/home/example.com/logs/php_error.log'); /** * This will log ...
71,185
<p>I've been playing with the wp custom header and background options.</p> <p>I like the way you can tile a small image for the background, and looking for a way to add that option to the custom header image as well.</p> <p>My theme has a div for the header and I've added the wp custom header like so:</p> <pre><code...
[ { "answer_id": 71186, "author": "Eric Holmes", "author_id": 23454, "author_profile": "https://wordpress.stackexchange.com/users/23454", "pm_score": 3, "selected": true, "text": "<p>You are putting an image into the style attribute - this is wrong. You only need the path, not a tag:</p>\...
2012/11/01
[ "https://wordpress.stackexchange.com/questions/71185", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22537/" ]
I've been playing with the wp custom header and background options. I like the way you can tile a small image for the background, and looking for a way to add that option to the custom header image as well. My theme has a div for the header and I've added the wp custom header like so: ``` <div class="header"> <img s...
You are putting an image into the style attribute - this is wrong. You only need the path, not a tag: ``` <div class="art-header" style="background-image:url('<?php header_image(); ?>'); background-repeat:repeat; height:<?php echo get_custom_header()->height; ?>px; width:<?php echo get_custom_header()->width;?>px;"> <...
71,206
<p>I am using the following loop on <code>index.php</code>.<br /> The current viewed page would be one of the link in the loop.<br /> <strong>How to make sure it is marked as current?</strong></p> <pre><code>&lt;ul id="questions" class="subpage"&gt; &lt;?php $index_query = new WP_Query( array( 'post_...
[ { "answer_id": 71209, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>On a <code>single.php</code> page you should have a <code>$post</code> object, which is created by WordPress ...
2012/11/01
[ "https://wordpress.stackexchange.com/questions/71206", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17269/" ]
I am using the following loop on `index.php`. The current viewed page would be one of the link in the loop. **How to make sure it is marked as current?** ``` <ul id="questions" class="subpage"> <?php $index_query = new WP_Query( array( 'post_type' => 'faq', 'orderby' => 'modified', 'posts_per_p...
Here's a rewritten version of your code ``` <ul id="questions" class="subpage"> <?php $current_id = get_the_ID(); $index_query = new WP_Query( array( 'post_type' => 'faq', 'orderby' => 'modified', 'posts_per_page' => '-1', 'order' => 'DESC' ) ); while ( $index_query->have_posts() ) : $index_query->the_post(); if...
71,226
<p>I found this great solution: <a href="https://wordpress.stackexchange.com/questions/29881/stop-wordpress-from-hardcoding-img-width-and-height-attributes">Stop wordpress from hardcoding img width and height attributes</a></p> <p>But I was wondering if I could do it only in one specific case and not in all the site b...
[ { "answer_id": 71232, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 1, "selected": false, "text": "<p>You can also get the data for width and hight of a image.</p>\n\n<pre><code>$src = wp_get_attachment_image_src( $a...
2012/11/01
[ "https://wordpress.stackexchange.com/questions/71226", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23195/" ]
I found this great solution: [Stop wordpress from hardcoding img width and height attributes](https://wordpress.stackexchange.com/questions/29881/stop-wordpress-from-hardcoding-img-width-and-height-attributes) But I was wondering if I could do it only in one specific case and not in all the site because it messes up o...
This worked for me. ``` function remove_width_and_height_attribute( $html ) { return preg_replace( '/(height|width)="\d*"\s/', "", $html ); } ``` and then change ``` wp_get_attachment_image_src( $attachment_id, 'full' ); ``` to ``` remove_width_and_height_attribute(wp_get_attachment_image_src( $attachment_id,...
71,248
<p><em>Is it possible to delete post/page revisions from the database when a post/page is published?</em></p> <p><strong>11/05/12 Answer: See the plugin below by <em>bueltge</em></strong></p> <p>I want to do this on a site with 5,000 posts and 125,000 comments; it's on a VPS and can handle the wp_posts table size - b...
[ { "answer_id": 71254, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 0, "selected": false, "text": "<p>It should be possible and it looks like you are on the right track.</p>\n\n<p>To solve your \"Call to a membe...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71248", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/268/" ]
*Is it possible to delete post/page revisions from the database when a post/page is published?* **11/05/12 Answer: See the plugin below by *bueltge*** I want to do this on a site with 5,000 posts and 125,000 comments; it's on a VPS and can handle the wp\_posts table size - before I deleted all revisions, the table wa...
I think a small plugin with the hook 'publish\_posts' is enough. But I dont know about a core function to delete revisions and I use a query with WP functions. The source is untested, written only for this post. ``` <?php /** * Plugin Name: WPSE71248 Delete Revisions on Publish Posts * Plugin URI: http://wordpress....
71,255
<p>I have a custom post type of 'artworks' and a custom taxonomy of 'artists'. On page-artists.php I have created a custom list of all the artists and would like to link each artist's name to the first post associated with that term instead of going to the term's page. This is my current code:</p> <pre><code>&lt;?php...
[ { "answer_id": 71270, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 2, "selected": true, "text": "<pre><code>// link artist name with first work by that artist\n$term_list .= '&lt;li&gt;&lt;a href=\"' . g...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71255", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18964/" ]
I have a custom post type of 'artworks' and a custom taxonomy of 'artists'. On page-artists.php I have created a custom list of all the artists and would like to link each artist's name to the first post associated with that term instead of going to the term's page. This is my current code: ``` <?php while ( have_post...
``` // link artist name with first work by that artist $term_list .= '<li><a href="' . get_term_link( $term->slug, $term->taxonomy ) . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $termfirst . ' ' . $term->name . '</a></li><li>' . the_terms() . '</li>'; ...
71,282
<p>I am using Post contents as a slider contents, i need to make the post infinite number of loop, ie, If i view the last post after that first post should display and before first post the last post.</p> <p>Please suggest </p>
[ { "answer_id": 71288, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 2, "selected": false, "text": "<p>A very basic example,</p>\n\n<pre><code>$args = array( 'post_type' =&gt; 'post', 'posts_per_page' =&gt; -1 );\n$...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71282", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17535/" ]
I am using Post contents as a slider contents, i need to make the post infinite number of loop, ie, If i view the last post after that first post should display and before first post the last post. Please suggest
A very basic example, ``` $args = array( 'post_type' => 'post', 'posts_per_page' => -1 ); $query= new WP_Query($args); while ( $query->have_posts() ) : $query->the_post(); the_content(); //example, use whatever template functions you like... endwhile; wp_reset_postdata(); //reset Post Data wp_reset_query(); //d...
71,283
<p>I would like to know what is the best way to create a different template for parent and children categories and/or taxonomies.</p> <p>Example: I have a taxonomy called region, which I want to divide in countries, and cities inside countries. So, I will have a parent taxonomy term called Italy, and it's children tax...
[ { "answer_id": 71285, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 1, "selected": false, "text": "<p>WordPress has a <a href=\"http://codex.wordpress.org/Template_Hierarchy\" rel=\"nofollow\">template hierarchy</a>...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71283", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18223/" ]
I would like to know what is the best way to create a different template for parent and children categories and/or taxonomies. Example: I have a taxonomy called region, which I want to divide in countries, and cities inside countries. So, I will have a parent taxonomy term called Italy, and it's children taxonomy term...
I suggest creating 3 files 1) regiontemplate-country.php 2) regiontemplate-city.php These 2 will contain the templates for country & city, then 3) taxonomy-region.php In this file, add the code to load the appropriate template ``` <?php $term = get_term_by('slug', get_query_var('term'), 'region'); if((int)$term->...
71,284
<p>I protected a page with password. I’d like to add a short error message when the inserted password is incorrect.</p> <p>How can I do this?</p> <p>I add this code to show and customize the form on my page. </p> <p>My <code>functions.php</code></p> <pre><code>add_filter( 'the_password_form', 'custom_password_for...
[ { "answer_id": 71299, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 5, "selected": true, "text": "<p>The latest entered password is stored as a secure hash in a cookie named <code>'wp-postpass_' . COOKIEHASH</code>. </p>...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71284", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12521/" ]
I protected a page with password. I’d like to add a short error message when the inserted password is incorrect. How can I do this? I add this code to show and customize the form on my page. My `functions.php` ``` add_filter( 'the_password_form', 'custom_password_form' ); function custom_password_form() { global $...
The latest entered password is stored as a secure hash in a cookie named `'wp-postpass_' . COOKIEHASH`. When the password form is called, that cookie has been **validated** already by WordPress. So you just have to check if that cookie **exists**: If it does and the password form is displayed, the password was wrong....
71,287
<p>I used the <a href="http://www.advancedcustomfields.com/" rel="nofollow">Advanced Custom Fields</a> plugin to add a custom field to my taxonomy. That custom field is an image which is associated with the term. Now I have a page where I display a list of all terms (for example, car manufacturers):</p> <pre><code>$te...
[ { "answer_id": 71289, "author": "Barry Walsh", "author_id": 23219, "author_profile": "https://wordpress.stackexchange.com/users/23219", "pm_score": 2, "selected": false, "text": "<p>Can you print the result of a $term so we can see what's stored? </p>\n\n<p>I have used this plugin instea...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71287", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18223/" ]
I used the [Advanced Custom Fields](http://www.advancedcustomfields.com/) plugin to add a custom field to my taxonomy. That custom field is an image which is associated with the term. Now I have a page where I display a list of all terms (for example, car manufacturers): ``` $terms = get_terms("manufacturer_tax", arra...
OK had a go at this myself, I didn't realise ACF was able to add fields to taxonomies which is really handy so I wanted to figure it out too. ``` <?php $libargs=array( 'hide_empty' => 0, 'parent' => 0, 'taxonomy' => 'library_categories'); ...
71,290
<p>I am making system where I am delegating a lot of functionality to the front end of a system using Wordpress. I have listed all the roles (most of the custom) and need to ability for a logged in user to edit the name of the role or delete it.</p> <p>I cant find any normal WP functions to do this, or plugins that al...
[ { "answer_id": 71291, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 4, "selected": true, "text": "<p>There's a whole host of functions specifically for this purpose;</p>\n\n<p><a href=\"http://codex.wordpress.org/Fu...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71290", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10645/" ]
I am making system where I am delegating a lot of functionality to the front end of a system using Wordpress. I have listed all the roles (most of the custom) and need to ability for a logged in user to edit the name of the role or delete it. I cant find any normal WP functions to do this, or plugins that allow the si...
There's a whole host of functions specifically for this purpose; <http://codex.wordpress.org/Function_Reference#User_and_Author_Functions> Of particular interest (but not limited to) are, ``` add_cap add_role get_role map_meta_cap remove_cap remove_role ``` As well as numerous other user related functions that wi...
71,296
<p>Having some troubles with a PHP script I am trying to build. </p> <p>I need to access the a file which is located in the root folder of my Wordpress install:</p> <p><strong>wordpress-root/live-config.php</strong></p> <p>Problem is, my script file is located inside the theme's root folder, and I'm trying to access...
[ { "answer_id": 71291, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 4, "selected": true, "text": "<p>There's a whole host of functions specifically for this purpose;</p>\n\n<p><a href=\"http://codex.wordpress.org/Fu...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71296", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5883/" ]
Having some troubles with a PHP script I am trying to build. I need to access the a file which is located in the root folder of my Wordpress install: **wordpress-root/live-config.php** Problem is, my script file is located inside the theme's root folder, and I'm trying to access the root folder when defining a cons...
There's a whole host of functions specifically for this purpose; <http://codex.wordpress.org/Function_Reference#User_and_Author_Functions> Of particular interest (but not limited to) are, ``` add_cap add_role get_role map_meta_cap remove_cap remove_role ``` As well as numerous other user related functions that wi...
71,303
<p>Ever come across a plugin that is using the <code>manage_options</code> capability for a page that... really doesn't need to be? Well, I've come across just that.</p> <p>This may be more of a general question about hooking into <code>add_submenu_page</code>, so not just specific to my use-case.</p> <p>I looked at ...
[ { "answer_id": 71310, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 4, "selected": true, "text": "<p>Hook into <code>admin_head</code>, the last action before the menu is rendered, and change the global <code>$menu</code...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71303", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9605/" ]
Ever come across a plugin that is using the `manage_options` capability for a page that... really doesn't need to be? Well, I've come across just that. This may be more of a general question about hooking into `add_submenu_page`, so not just specific to my use-case. I looked at `add_dashboard_page` which is simply a ...
Hook into `admin_head`, the last action before the menu is rendered, and change the global `$menu`: ``` add_action( 'admin_head', 'wpse_71303_change_menu_cap' ); /** * Change the capability to access an admin menu item. * * @wp-hook admin_head * @return void */ function wpse_71303_change_menu_cap() { global ...
71,304
<p>So, i have a function in my template file functions.php which cache a search form that contain a custom taxonomie terms. I want to flush cache (or delete one cache group) when I add/delete/edit terms of a specific taxonomie.</p> <p>Is it possible? maybe with do_action, but for which hook? thx</p>
[ { "answer_id": 71306, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 4, "selected": false, "text": "<p>Look at <code>wp-includes/taxonomy.php</code>. The actions are:</p>\n\n<pre><code>do_action( \"create_term\", $t...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71304", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23223/" ]
So, i have a function in my template file functions.php which cache a search form that contain a custom taxonomie terms. I want to flush cache (or delete one cache group) when I add/delete/edit terms of a specific taxonomie. Is it possible? maybe with do\_action, but for which hook? thx
Look at `wp-includes/taxonomy.php`. The actions are: ``` do_action( "create_term", $term_id, $tt_id, $taxonomy ); do_action( "created_term", $term_id, $tt_id, $taxonomy ); do_action( "edited_term", $term_id, $tt_id, $taxonomy ); do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_ter...
71,311
<p>I'm trying to make a php script which, given a post id, returns post content. I'm not the one who writes articles, I'm just operating on a wp site. Post content is for an app of mine which has to parse it.</p> <p>My script is very simple:</p> <pre><code>&lt;?php require_once("wp-load.php"); if(isset($_GET...
[ { "answer_id": 71312, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 0, "selected": false, "text": "<p>That’s a <a href=\"http://codex.wordpress.org/Shortcode_API\" rel=\"nofollow\">shortcode</a>, and you should run …</p>...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71311", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23030/" ]
I'm trying to make a php script which, given a post id, returns post content. I'm not the one who writes articles, I'm just operating on a wp site. Post content is for an app of mine which has to parse it. My script is very simple: ``` <?php require_once("wp-load.php"); if(isset($_GET['id'])){ $pos...
The `[caption]` part shows up because one of your authors/editors added a caption to the image when it was inserted into the post. You will have this problem not only with captions but with any other shortcodes that your authors/editors use. And you should be aware that WordPress includes several in its Core but variou...
71,313
<p>I'm adding a custom column named Excerpt with Codepress Admin Columns, and would like to know specifically when the Excerpt has not been filled out. Instead WordPress shows post content automatically, if the excerpt is missing. This is also testable by switching on the "Excerpt View" from post list screen. </p> <p>...
[ { "answer_id": 71316, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>There is <a href=\"http://queryposts.com/function/has_excerpt/\" rel=\"nofollow\"><code>has_excerpt()</code></a> fun...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71313", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11614/" ]
I'm adding a custom column named Excerpt with Codepress Admin Columns, and would like to know specifically when the Excerpt has not been filled out. Instead WordPress shows post content automatically, if the excerpt is missing. This is also testable by switching on the "Excerpt View" from post list screen. Implementi...
Just illustrating this in full effect here with the filters and functions for both the adding of custom column and testing for excerpt existence. Note, I've purposely ripped the guts out of `has_excerpt` to show you in effect what is occurring under the hood. You can use `!has_excerpt` in its place. ``` add_filter('...
71,321
<p>I have a shortcode that is built using a Thickbox form with various inputs that return the values. This works fine. However, I would like the existing values (if present) to re-populate the form if the user opens it again.</p> <p><strong>Here is an example of my shortcode:</strong> </p> <p><code>[schema type="pers...
[ { "answer_id": 71323, "author": "pete_schuster", "author_id": 1388, "author_profile": "https://wordpress.stackexchange.com/users/1388", "pm_score": 0, "selected": false, "text": "<p>I would look into using jQuery's .data() function. Because its a shortcode, you can't really store values ...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71321", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/403/" ]
I have a shortcode that is built using a Thickbox form with various inputs that return the values. This works fine. However, I would like the existing values (if present) to re-populate the form if the user opens it again. **Here is an example of my shortcode:** `[schema type="person" name="Andrew Norcross" descript...
Try something like this... ``` var code = $('div#wp-content-editor-container textarea').text().match(/\[(schema.*)\]/); code = '<' + code[1] + '>'; alert($(code).attr('description'));​​​​ ```
71,328
<p>I run a website that I run stories that deal with other people's work and I want to allow them to view the specific post dealing with them, but without them having a wordpress login. </p> <p>I tried making it password protected but it shows up on the website, and I would not like people seeing it, even if it is jus...
[ { "answer_id": 71323, "author": "pete_schuster", "author_id": 1388, "author_profile": "https://wordpress.stackexchange.com/users/1388", "pm_score": 0, "selected": false, "text": "<p>I would look into using jQuery's .data() function. Because its a shortcode, you can't really store values ...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71328", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23228/" ]
I run a website that I run stories that deal with other people's work and I want to allow them to view the specific post dealing with them, but without them having a wordpress login. I tried making it password protected but it shows up on the website, and I would not like people seeing it, even if it is just a title ...
Try something like this... ``` var code = $('div#wp-content-editor-container textarea').text().match(/\[(schema.*)\]/); code = '<' + code[1] + '>'; alert($(code).attr('description'));​​​​ ```
71,332
<p>Here is my wordpress theme to check out(its not completely finished): <a href="http://benlevywebdesign.com/wordpress/" rel="nofollow noreferrer">http://benlevywebdesign.com/wordpress/</a></p> <p>This is my first time working with php/wordpress and making themes so keep that in mind. I have an index.php, css, and a ...
[ { "answer_id": 71333, "author": "dmarges", "author_id": 22636, "author_profile": "https://wordpress.stackexchange.com/users/22636", "pm_score": 0, "selected": false, "text": "<p>Use custom post formats. Would pretty much do exactly what you want!</p>\n\n<p><a href=\"http://codex.wordpres...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71332", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22873/" ]
Here is my wordpress theme to check out(its not completely finished): <http://benlevywebdesign.com/wordpress/> This is my first time working with php/wordpress and making themes so keep that in mind. I have an index.php, css, and a 960.css file and don't know about the other files that you can include. In my theme I ...
Depending on which 'types' you need, you might be looking for the [Post Format](http://codex.wordpress.org/Post_Formats) functionality. It allows you to set posts as standard, quotes, galleries, etc (sort of like Tumblr). To activate it, simply toss this into your theme (probably functions.php): `add_theme_support( 'p...
71,343
<p>I am working on a membership site which requires a front-end user search. I have been searching for an answer like a mad man, and I could really use some help! While there are several plugins that have this capability (WordPress Members List, AMR Users, etc.); none of them do exactly what I need, and by looking at t...
[ { "answer_id": 71344, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 0, "selected": false, "text": "<p>I think the WordPress function you're looking for is:</p>\n\n<ul>\n<li>get_the_author_meta() at <a href=\"http:/...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71343", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23231/" ]
I am working on a membership site which requires a front-end user search. I have been searching for an answer like a mad man, and I could really use some help! While there are several plugins that have this capability (WordPress Members List, AMR Users, etc.); none of them do exactly what I need, and by looking at thei...
As you haven't offered the details on what you're after, I'll try to grab them all very briefly. Use the API - public `WP_User_Query` API functions -------------------------------------------------- Basically [`get_user_by()`](http://queryposts.com/function/get_user_by/) should be enough for you. Let's say you fire o...
71,345
<p>I have a Wordpress website that needs to be available in two different languages. We have the articles written in both languages already. </p> <p>I've seen a lot of solutions providing automatic translations but this won't work in this situation because we have to use translations produced by government approved tr...
[ { "answer_id": 71344, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 0, "selected": false, "text": "<p>I think the WordPress function you're looking for is:</p>\n\n<ul>\n<li>get_the_author_meta() at <a href=\"http:/...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71345", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10032/" ]
I have a Wordpress website that needs to be available in two different languages. We have the articles written in both languages already. I've seen a lot of solutions providing automatic translations but this won't work in this situation because we have to use translations produced by government approved translators....
As you haven't offered the details on what you're after, I'll try to grab them all very briefly. Use the API - public `WP_User_Query` API functions -------------------------------------------------- Basically [`get_user_by()`](http://queryposts.com/function/get_user_by/) should be enough for you. Let's say you fire o...
71,353
<p>I want to show in latest posts widget only posts by admin (now its showing latests posts by all suers). How I can do it ? via wp query ? Thanks :) </p> <pre><code>&lt;?php // setup the query $args='&amp;posts_per_page='.$numreviews.'_reviews&amp;order=DESC&amp;orderby='.$feedsort.$metakey; ...
[ { "answer_id": 71355, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>You need to <a href=\"http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters\" rel=\"nofollow\...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71353", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23233/" ]
I want to show in latest posts widget only posts by admin (now its showing latests posts by all suers). How I can do it ? via wp query ? Thanks :) ``` <?php // setup the query $args='&posts_per_page='.$numreviews.'_reviews&order=DESC&orderby='.$feedsort.$metakey; ...
You need to [add an author parameter](http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters) to the query that is creating `$cust_loop`. You didn't post that part of your code but something like: ``` $cust_loop = new WP_Query( 'author=123' ); ``` Or: ``` $cust_loop = new WP_Query( 'author_name=rami'...
71,368
<p>My site has a user profile page. For some reason I would like to pull user profile data in my plugin. </p> <p>I know I can pull logged in user profile data using <code>get_currentuserinfo();</code>.</p> <p>For example I would like to get displayed profile user id.</p> <p>Can anyone tell me how to pull it.?</p>
[ { "answer_id": 71355, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<p>You need to <a href=\"http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters\" rel=\"nofollow\...
2012/11/02
[ "https://wordpress.stackexchange.com/questions/71368", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5074/" ]
My site has a user profile page. For some reason I would like to pull user profile data in my plugin. I know I can pull logged in user profile data using `get_currentuserinfo();`. For example I would like to get displayed profile user id. Can anyone tell me how to pull it.?
You need to [add an author parameter](http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters) to the query that is creating `$cust_loop`. You didn't post that part of your code but something like: ``` $cust_loop = new WP_Query( 'author=123' ); ``` Or: ``` $cust_loop = new WP_Query( 'author_name=rami'...
71,382
<p>I am trying to figure out on how do I make my wordpress website to be able to add <code>portfolio</code> items from the frontend. Plugins such as WP-User-Frontend allows posting from frontend but only works with blog posts. </p> <p>Is there any ways or any plugins similar to wp-user-frotend but being able to add cu...
[ { "answer_id": 71386, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 5, "selected": true, "text": "<p>If you are willing to pay for it, the Gravity Forms plugin allows you to create forms that map to your Custom Post...
2012/11/03
[ "https://wordpress.stackexchange.com/questions/71382", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23246/" ]
I am trying to figure out on how do I make my wordpress website to be able to add `portfolio` items from the frontend. Plugins such as WP-User-Frontend allows posting from frontend but only works with blog posts. Is there any ways or any plugins similar to wp-user-frotend but being able to add custom post type items?
If you are willing to pay for it, the Gravity Forms plugin allows you to create forms that map to your Custom Post Types (even regular post and page - types) as well as map to your custom fields. For those who aren't and who are willing to roll up their sleeves then you can create a front end form that posts data int...
71,389
<p>Basically, I want to follow the author by other WordPress users. Whenever an author posts new post subscribed users need to get notification by email.</p> <p>If it's not already there, I can create a plugin for this. But I need an idea to store the data. Should I go for custom table or is there a better way to stor...
[ { "answer_id": 71386, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 5, "selected": true, "text": "<p>If you are willing to pay for it, the Gravity Forms plugin allows you to create forms that map to your Custom Post...
2012/11/03
[ "https://wordpress.stackexchange.com/questions/71389", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4022/" ]
Basically, I want to follow the author by other WordPress users. Whenever an author posts new post subscribed users need to get notification by email. If it's not already there, I can create a plugin for this. But I need an idea to store the data. Should I go for custom table or is there a better way to store default ...
If you are willing to pay for it, the Gravity Forms plugin allows you to create forms that map to your Custom Post Types (even regular post and page - types) as well as map to your custom fields. For those who aren't and who are willing to roll up their sleeves then you can create a front end form that posts data int...
71,405
<p>I need to add a span class in the post title, something like this:</p> <p><img src="https://i.stack.imgur.com/Hzfv6.png" alt="See this picture (a picture is worth a thousand words!)."></p> <p>How to do that? Is this possible?</p>
[ { "answer_id": 71407, "author": "Miha Rekar", "author_id": 20791, "author_profile": "https://wordpress.stackexchange.com/users/20791", "pm_score": 0, "selected": false, "text": "<p>First of all, the HTML on the image is not valid - close your <code>&lt;span&gt;</code> with <code>&lt;/spa...
2012/11/03
[ "https://wordpress.stackexchange.com/questions/71405", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23255/" ]
I need to add a span class in the post title, something like this: ![See this picture (a picture is worth a thousand words!).](https://i.stack.imgur.com/Hzfv6.png) How to do that? Is this possible?
Wouldn't the simplest approach be to use a filter on the\_title()? ``` function add_span($title, $id) { return $title .' <span class="title_span">' .get_post_meta($post_id, $key, $single) ."</span>"; } add_filter('the_title', 'add_span', 10, 2); ``` This approach of course assumes you're storing your span dat...
71,406
<p>So like WP must load series of files from, </p> <p><code>index.php -&gt; ... -&gt; wp-header.php -&gt; ... -&gt;functions.php</code> </p> <p>...and so on upon execution. </p> <p>Also there must be a similar flowchart for functions callings, conditionals and such <em>during</em> the execution. Is such a flowchart(...
[ { "answer_id": 71410, "author": "Rohit Pande", "author_id": 21274, "author_profile": "https://wordpress.stackexchange.com/users/21274", "pm_score": 2, "selected": false, "text": "<p>Not exactly the diagrammatic view but I can provide you the description view like <a href=\"https://web.ar...
2012/11/03
[ "https://wordpress.stackexchange.com/questions/71406", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15816/" ]
So like WP must load series of files from, `index.php -> ... -> wp-header.php -> ... ->functions.php` ...and so on upon execution. Also there must be a similar flowchart for functions callings, conditionals and such *during* the execution. Is such a flowchart(s) available anywhere?
There is this rather in-depth explanation found at, Part 1 ------ <http://theme.fm/2011/09/wordpress-internals-how-wordpress-boots-up-2315/> Part 2 ------ <http://theme.fm/2011/09/wordpress-internals-how-wordpress-boots-up-part-2-2437/> Which also includes some diagrams/flowcharts. [![enter image description here...
71,415
<p>I use the custom header feature for my theme and I’d like to add an additional upload field to the Custom Header page in the backend (page=custom-header) for a custom logo upload.</p> <p>I found <a href="https://illuminatikarate.com/blog/add-your-own-options-to-wordpress-custom-header-image-screen/" rel="nofollow">...
[ { "answer_id": 71443, "author": "clark", "author_id": 23041, "author_profile": "https://wordpress.stackexchange.com/users/23041", "pm_score": 3, "selected": false, "text": "<p>I just did something similar recently. Instead of putting it on the Custom Header page, you should be adding thi...
2012/11/03
[ "https://wordpress.stackexchange.com/questions/71415", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21110/" ]
I use the custom header feature for my theme and I’d like to add an additional upload field to the Custom Header page in the backend (page=custom-header) for a custom logo upload. I found [this](https://illuminatikarate.com/blog/add-your-own-options-to-wordpress-custom-header-image-screen/) but the custom options aren...
I just did something similar recently. Instead of putting it on the Custom Header page, you should be adding things to the Theme Customizer (new in 3.4). It's just as easy and is a more standard way of adding new theme options. In fact, just by having added the Custom Header, the Theme Customizer should be active on y...
71,420
<p>I need to see if an option, and if does, get the value. If not, I need to add it.</p> <p>The <a href="http://codex.wordpress.org/Function_Reference/update_option" rel="nofollow noreferrer">Codex</a> provides:</p> <pre><code>&lt;?php $option_name = 'myhack_extraction_length' ; $new_value = '255' ; if ( get_option( $...
[ { "answer_id": 71428, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<blockquote>\n <p>Is this correct?</p>\n</blockquote>\n\n<p>If you mean \"when does the 'if' execute and when d...
2012/11/03
[ "https://wordpress.stackexchange.com/questions/71420", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16178/" ]
I need to see if an option, and if does, get the value. If not, I need to add it. The [Codex](http://codex.wordpress.org/Function_Reference/update_option) provides: ``` <?php $option_name = 'myhack_extraction_length' ; $new_value = '255' ; if ( get_option( $option_name ) != $new_value ) { update_option( $option_...
The logic on the IF THEN ELSE does seem a bit wonky. If I'm reading it correctly... The call to get\_option( $option\_name ) will return FALSE if the option does not exist or if it has no value. So the *IF* would be executed: 1. when the option doesn't exist and $new\_value != FALSE 2. the option has no value and $n...
71,427
<pre><code>add_action( 'customize_register', 'boilerplate_customize_register' ); function boilerplate_customize_register($wp_customize) { $wp_customize-&gt;add_section( 'themename_color_scheme', array( 'title' =&gt; __( 'Color Scheme (sect!on name)', 'themename' ), 'description' =&gt; "T...
[ { "answer_id": 71428, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 2, "selected": false, "text": "<blockquote>\n <p>Is this correct?</p>\n</blockquote>\n\n<p>If you mean \"when does the 'if' execute and when d...
2012/11/03
[ "https://wordpress.stackexchange.com/questions/71427", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15816/" ]
``` add_action( 'customize_register', 'boilerplate_customize_register' ); function boilerplate_customize_register($wp_customize) { $wp_customize->add_section( 'themename_color_scheme', array( 'title' => __( 'Color Scheme (sect!on name)', 'themename' ), 'description' => "This changes colo...
The logic on the IF THEN ELSE does seem a bit wonky. If I'm reading it correctly... The call to get\_option( $option\_name ) will return FALSE if the option does not exist or if it has no value. So the *IF* would be executed: 1. when the option doesn't exist and $new\_value != FALSE 2. the option has no value and $n...
71,451
<p>When I use the following code, everything shows <em>except</em> the reply link! Anybody know what I've done wrong? I'd like the link to show up with the word 'Reply.'</p> <p>Live example: <a href="http://themeforward.com/demo2/?p=1948#commentlist" rel="nofollow">http://themeforward.com/demo2/?p=1948#commentlist</...
[ { "answer_id": 71452, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 1, "selected": false, "text": "<p>You're simply missing the comment reply script. Enqueue it and you're don.</p>\n\n<pre><code>// Add this to your bo...
2012/11/03
[ "https://wordpress.stackexchange.com/questions/71451", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5205/" ]
When I use the following code, everything shows *except* the reply link! Anybody know what I've done wrong? I'd like the link to show up with the word 'Reply.' Live example: <http://themeforward.com/demo2/?p=1948#commentlist> In my header: ``` <?php if ( is_singular() && comments_open() && get_option('thread_comment...
My suggestion would be twofold: 1. Ensure you are properly enqueueing the `comment-reply` script 2. Replace your hard-coded comment list with [`wp_list_comments()`](http://codex.wordpress.org/Function_Reference/wp_list_comments) Enqueueing `comment-reply` -------------------------- I would recommend hooking into `co...
71,471
<p>Problem: I need to get an array of ID's of posts from a given category If the category have any posts. This is to be used on a plugin options page.</p> <p>So far I have:</p> <pre><code>$posts = get_posts(array('numberposts' =&gt; 10000, 'category' =&gt; 5)); </code></pre> <p>But I'm struggling with How do I gen a...
[ { "answer_id": 71473, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 5, "selected": true, "text": "<p>The thing to remember about <code>get_posts</code> is that is uses a <code>WP_Query</code> object internal...
2012/11/04
[ "https://wordpress.stackexchange.com/questions/71471", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15704/" ]
Problem: I need to get an array of ID's of posts from a given category If the category have any posts. This is to be used on a plugin options page. So far I have: ``` $posts = get_posts(array('numberposts' => 10000, 'category' => 5)); ``` But I'm struggling with How do I gen an array containing just the ID of each ...
The thing to remember about `get_posts` is that is uses a `WP_Query` object internally. `get_posts` source: ``` <?php /** * Retrieve list of latest posts or posts matching criteria. * * The defaults are as follows: * 'numberposts' - Default is 5. Total number of posts to retrieve. * 'offset' - Default is ...
71,503
<p>I want to get rid of the complete thickbox css js and loading gif. Can anybody give me the correct way to get rid of it all via functions.php ?</p> <p>Cheers, Alex</p>
[ { "answer_id": 71505, "author": "Babar Al-Amin", "author_id": 23290, "author_profile": "https://wordpress.stackexchange.com/users/23290", "pm_score": 0, "selected": false, "text": "<p>Have you installed the plugin yourself?\nThen deactivate and/or delete it from the Plugin section of you...
2012/11/04
[ "https://wordpress.stackexchange.com/questions/71503", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23289/" ]
I want to get rid of the complete thickbox css js and loading gif. Can anybody give me the correct way to get rid of it all via functions.php ? Cheers, Alex
I'm guessing front end only, right? ``` function wpse71503_init() { if (!is_admin()) { wp_deregister_style('thickbox'); wp_deregister_script('thickbox'); } } add_action('init', 'wpse71503_init'); ```
71,544
<p>For my post I have a box for the post image and the size of the box is 214 x 73. I want the image to fit the width of the box and have it cropped at 73px height.</p> <p>This is what I have so far in my functions.php file</p> <pre><code>&lt;?php add_theme_support( 'post-thumbnails'); set_post_thumbnail_size(); ...
[ { "answer_id": 71546, "author": "Babar Al-Amin", "author_id": 23290, "author_profile": "https://wordpress.stackexchange.com/users/23290", "pm_score": -1, "selected": false, "text": "<p>You can use <a href=\"http://www.binarymoon.co.uk/projects/timthumb/\" rel=\"nofollow\">TimThumb</a> sc...
2012/11/04
[ "https://wordpress.stackexchange.com/questions/71544", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22873/" ]
For my post I have a box for the post image and the size of the box is 214 x 73. I want the image to fit the width of the box and have it cropped at 73px height. This is what I have so far in my functions.php file ``` <?php add_theme_support( 'post-thumbnails'); set_post_thumbnail_size(); if ( function_exists( 'add...
I don't think your code is the issue here. But there are a few caveats that you need to be aware of and account for. First off always keep in mind that when using add\_image\_size() that WordPress does not regenerate the images size if it was uploaded before you registered the new size. The newly registered size will ...
71,569
<p><a href="http://wordpress.org/extend/plugins/wp-firephp/" rel="nofollow">http://wordpress.org/extend/plugins/wp-firephp/</a></p> <p>I'm simply supposed to call <code>fb('Error message','Lable')</code> but it doesn't work all the time. I can't figure out when and where the relevant files are being included and class...
[ { "answer_id": 71599, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 4, "selected": true, "text": "<p>I gave up on using the plugin and use FirePHP straight as a <code>mu-plugin</code>:</p>\n<p><img src=\"https:...
2012/11/05
[ "https://wordpress.stackexchange.com/questions/71569", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15816/" ]
<http://wordpress.org/extend/plugins/wp-firephp/> I'm simply supposed to call `fb('Error message','Lable')` but it doesn't work all the time. I can't figure out when and where the relevant files are being included and classes defined in order to make the call to the said method/function. For example it doesn't work ...
I gave up on using the plugin and use FirePHP straight as a `mu-plugin`: ![FirePHP mu-plugin](https://i.stack.imgur.com/TcZTp.png) And `firebug.php` file consists of: ``` <?php /* Plugin Name: FirePHP Version: 0.1 */ require_once( 'FirePHPCore/FirePHP.class.php' ); ob_start(); $firephp = FirePHP::getInstanc...
71,576
<p>I am building a section on a site where I am merging <em>two different post types</em> into one loop, and then displaying them randomly. The problem is, I'm having a hard time finding a way to limit the amount of posts <em>per</em> type.</p> <p>Here's what I've tried:</p> <ul> <li><p>One query with multiple post t...
[ { "answer_id": 71582, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 5, "selected": true, "text": "<p>One way is to customize the SQL query executed using <code>posts_clauses</code> or other such filters. ...
2012/11/05
[ "https://wordpress.stackexchange.com/questions/71576", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23312/" ]
I am building a section on a site where I am merging *two different post types* into one loop, and then displaying them randomly. The problem is, I'm having a hard time finding a way to limit the amount of posts *per* type. Here's what I've tried: * One query with multiple post types can be achieved with an array: `...
One way is to customize the SQL query executed using `posts_clauses` or other such filters. To find them search for `posts_clauses` in "wp-includes/query.php" & see the series of filters just before this line. These together are capable of customizing any part of the query Another thing you can do is manually merge th...
71,580
<p>I have a menu generated by <code>wp_nav_menu</code> which look like</p> <pre><code>&lt;ul class="nav-menu" id="menu-top-nav"&gt; &lt;li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-43" id="menu-item-43"&gt;&lt;a href="http://www.example.com/item1.com"&gt;Item 1&lt;/a&gt;&lt;/li&gt; ...
[ { "answer_id": 71613, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 0, "selected": false, "text": "<p>The Hook <code>wp_nav_menu_items</code> is right if you will add items to the structure of WP Nav Menu.\nSee the t...
2012/11/05
[ "https://wordpress.stackexchange.com/questions/71580", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22904/" ]
I have a menu generated by `wp_nav_menu` which look like ``` <ul class="nav-menu" id="menu-top-nav"> <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-43" id="menu-item-43"><a href="http://www.example.com/item1.com">Item 1</a></li> <li class="menu-item menu-item-type-custom menu-item...
You can modify your menu by using walker. ``` include('subMenu.php'); $menu = wp_nav_menu( array('menu' => 'YOUR-MENU-NAME','menu_class' => 'megamenu','walker' => new subMenu)); ``` create a file subMenu.php in theme folder add below code. ``` <?php class subMenu extends Walker_Nav_Menu { function end_el(&$out...
71,597
<p>I previously was able to change the numbers of the date and time (into a number and date system of another language, like Khmer) for each post using a script like this in my functions.php:</p> <pre><code>function KhmerNumDate ($text) { $text = str_replace('1', '១', $text); $text = str_replace('2', '២', $text); $tex...
[ { "answer_id": 71620, "author": "Nathan", "author_id": 21392, "author_profile": "https://wordpress.stackexchange.com/users/21392", "pm_score": 3, "selected": true, "text": "<p>Turns out it was because of the way the theme Twenty Twelve works (in their effort to make translation easy...)....
2012/11/05
[ "https://wordpress.stackexchange.com/questions/71597", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21392/" ]
I previously was able to change the numbers of the date and time (into a number and date system of another language, like Khmer) for each post using a script like this in my functions.php: ``` function KhmerNumDate ($text) { $text = str_replace('1', '១', $text); $text = str_replace('2', '២', $text); $text = str_replac...
Turns out it was because of the way the theme Twenty Twelve works (in their effort to make translation easy...). The date for posts in Twenty Twelve is prepared by a function in functions.php called `twentytwelve_entry_meta()` So to replace/translate the numbers in the date, I look for the line with `$date=` in the `...
71,598
<p>I have a web site, that while working properly, every day, at 11:00am using a huge amounts of the server resources.</p> <p>The web hosting account contains only the WordPress, and I don't have any other software installed.</p> <p>Also, the hosting account is based on Cloud Linux, that means I can have statistics a...
[ { "answer_id": 71621, "author": "markratledge", "author_id": 268, "author_profile": "https://wordpress.stackexchange.com/users/268", "pm_score": 4, "selected": true, "text": "<p>You need to check the actual access logs, such as web, SSH, etc., and if you can access it, the MySQL log, too...
2012/11/05
[ "https://wordpress.stackexchange.com/questions/71598", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7850/" ]
I have a web site, that while working properly, every day, at 11:00am using a huge amounts of the server resources. The web hosting account contains only the WordPress, and I don't have any other software installed. Also, the hosting account is based on Cloud Linux, that means I can have statistics about my account r...
You need to check the actual access logs, such as web, SSH, etc., and if you can access it, the MySQL log, too. That will show you what is possibly hitting the site at that time and let you differentiate between a huge unexplained web traffic spike from a bot and something that is happening in Wordpress or the theme it...
71,615
<p>I have written a plugin that (besides other functionality) makes posts from existing content. For each post I have one picture - <strong>how to make them featured programmatically</strong>?</p> <p>I do the:</p> <pre><code>$id = wp_insert_post( $my_post ); wp_set_object_terms( $id, $cat_ids, 'category' ); </code><...
[ { "answer_id": 71616, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 4, "selected": true, "text": "<p>Try using <a href=\"http://codex.wordpress.org/Function_Reference/set_post_thumbnail\" rel=\"noreferrer\"><s...
2012/11/05
[ "https://wordpress.stackexchange.com/questions/71615", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20317/" ]
I have written a plugin that (besides other functionality) makes posts from existing content. For each post I have one picture - **how to make them featured programmatically**? I do the: ``` $id = wp_insert_post( $my_post ); wp_set_object_terms( $id, $cat_ids, 'category' ); ``` and I would like my next step to be ...
Try using [**`set_post_thumbnail()`**](http://codex.wordpress.org/Function_Reference/set_post_thumbnail). Assuming you already know how to determine the `$post` (ID or object) for which to set the featured image, and the `$thumbnail_id` (ID) of the image that you want to set as the featured image: ``` set_post_thumbn...
71,630
<p>I have a Wordpress website with 20+ categories. To make it easier to navigate I want to decrease the categories, but at the same time keep the original categories. In other words I want to be able to query multiple categories with a category group or a virtual slug.</p> <p>Example categories:</p> <pre><code>/categ...
[ { "answer_id": 71631, "author": "Pekka", "author_id": 2161, "author_profile": "https://wordpress.stackexchange.com/users/2161", "pm_score": 2, "selected": false, "text": "<p>Wouldn't WordPress's built-in sub-categories functionality solve this problem?</p>\n\n<pre><code> + fruit\n + ban...
2012/11/03
[ "https://wordpress.stackexchange.com/questions/71630", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23365/" ]
I have a Wordpress website with 20+ categories. To make it easier to navigate I want to decrease the categories, but at the same time keep the original categories. In other words I want to be able to query multiple categories with a category group or a virtual slug. Example categories: ``` /category/apples/ /category...
Wouldn't WordPress's built-in sub-categories functionality solve this problem? ``` + fruit + bananas + apples + pears ``` you would get all of fruit through ``` /categories/fruit ``` but also specific categories through ``` /categories/fruit/bananas ``` to add a sub-category, just choose `fruit` as the...
71,633
<p>I'm currently working on this <a href="http://pba.siteprogression.com/" rel="nofollow">website</a> and a test shows that the search page isn't working properly. Every time someone searches for something, it comes up blank. The code for the search page is as shown below.</p> <p><strong>Search Form:</strong></p> <p...
[ { "answer_id": 71631, "author": "Pekka", "author_id": 2161, "author_profile": "https://wordpress.stackexchange.com/users/2161", "pm_score": 2, "selected": false, "text": "<p>Wouldn't WordPress's built-in sub-categories functionality solve this problem?</p>\n\n<pre><code> + fruit\n + ban...
2012/11/05
[ "https://wordpress.stackexchange.com/questions/71633", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22594/" ]
I'm currently working on this [website](http://pba.siteprogression.com/) and a test shows that the search page isn't working properly. Every time someone searches for something, it comes up blank. The code for the search page is as shown below. **Search Form:** ``` <form role="search" method="get" id="searchform" act...
Wouldn't WordPress's built-in sub-categories functionality solve this problem? ``` + fruit + bananas + apples + pears ``` you would get all of fruit through ``` /categories/fruit ``` but also specific categories through ``` /categories/fruit/bananas ``` to add a sub-category, just choose `fruit` as the...
71,666
<p>How can I a add forward slash on categories URLs and serve only that version of a category (meaning URLs not ending in forward-slash will redirect to URLs ending in forward slash).</p> <p>I manage to remove the category base using the "WP No Category Base" plugin but I need to add a forward slash on the category UR...
[ { "answer_id": 71667, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": true, "text": "<p>Filter <code>category_link</code> so WordPress <strong>creates</strong> slashed URLs for categories, and <code>redirect...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71666", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15704/" ]
How can I a add forward slash on categories URLs and serve only that version of a category (meaning URLs not ending in forward-slash will redirect to URLs ending in forward slash). I manage to remove the category base using the "WP No Category Base" plugin but I need to add a forward slash on the category URL. Exampl...
Filter `category_link` so WordPress **creates** slashed URLs for categories, and `redirect_canonical` so it **accepts** those URLs: ``` add_filter( 'category_link', 'wpse_71666_trailingslash_cat_url' ); add_filter( 'redirect_canonical', 'wpse_71666_trailingslash_cat_url', 20, 2 ); function wpse_71666_trailingslash_ca...
71,673
<p>I am in the process of transferring posts from one WordPress install to another. I can use WordPress' Tools --> Export to export the XML I need for my posts. On the new install, I then use Tools --> Import to load the XML. I check "Download and import file attachments" and then finish the import. The pictures that a...
[ { "answer_id": 71667, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": true, "text": "<p>Filter <code>category_link</code> so WordPress <strong>creates</strong> slashed URLs for categories, and <code>redirect...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71673", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9636/" ]
I am in the process of transferring posts from one WordPress install to another. I can use WordPress' Tools --> Export to export the XML I need for my posts. On the new install, I then use Tools --> Import to load the XML. I check "Download and import file attachments" and then finish the import. The pictures that are ...
Filter `category_link` so WordPress **creates** slashed URLs for categories, and `redirect_canonical` so it **accepts** those URLs: ``` add_filter( 'category_link', 'wpse_71666_trailingslash_cat_url' ); add_filter( 'redirect_canonical', 'wpse_71666_trailingslash_cat_url', 20, 2 ); function wpse_71666_trailingslash_ca...
71,687
<p>I have few thousands posts and need to list all of them in the admin. When I used WP_Query to get them all at once I got a memory error. Then I split it into several query calls and it worked just fine with 256 MB limit. Here is the code:</p> <pre><code>$limit = 200; $offset = 0; while (TRUE) { $posts = new WP_...
[ { "answer_id": 71692, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 4, "selected": true, "text": "<p>The posts are still held in memory under WordPress' cache mechanism (even though you replace <code>$posts</c...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71687", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5902/" ]
I have few thousands posts and need to list all of them in the admin. When I used WP\_Query to get them all at once I got a memory error. Then I split it into several query calls and it worked just fine with 256 MB limit. Here is the code: ``` $limit = 200; $offset = 0; while (TRUE) { $posts = new WP_Query(array( ...
The posts are still held in memory under WordPress' cache mechanism (even though you replace `$posts` on every loop) - delete each one after operating on it: ``` # do some echoing with the $post # wipe post from memory wp_cache_delete( $post->ID, 'posts' ); wp_cache_delete( $post->ID, 'post_meta' ); ``` Pro tip: sa...
71,691
<p>I have been tracking the slow queries log of the WP based site (with the default value of the <a href="http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_long_query_time">a long_query_time</a> set to 10), and I have noticed that the following query is often getting logged -</p> <pre><code># ...
[ { "answer_id": 71729, "author": "Vinay Pai", "author_id": 3740, "author_profile": "https://wordpress.stackexchange.com/users/3740", "pm_score": 5, "selected": true, "text": "<p><strong>Update</strong>: The reason the query is being logged is it <a href=\"http://dev.mysql.com/doc/refman/5...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71691", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15571/" ]
I have been tracking the slow queries log of the WP based site (with the default value of the [a long\_query\_time](http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_long_query_time) set to 10), and I have noticed that the following query is often getting logged - ``` # User@Host: root[root] @...
**Update**: The reason the query is being logged is it [doesn't use an index](http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html). The query time is 0, i.e. it actually executes fast. You can unset the "log-queries-not-using-indexes" option if you don't want these to be logged. ~~The wp\_options table has no i...
71,706
<p>I have a password-protected page, for whom I'd like to use a custom template to query posts from a specific category. How can I achieve that query_posts should work only after users submit the password of the page? I'm trying with this but doesn't work (page only displays header and footer)</p> <pre><code>&lt;?php ...
[ { "answer_id": 71715, "author": "windyjonas", "author_id": 221, "author_profile": "https://wordpress.stackexchange.com/users/221", "pm_score": 2, "selected": true, "text": "<p>separate the queries for the current page and the query for all posts in a category.<br>\nUntested example:</p>\...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71706", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23296/" ]
I have a password-protected page, for whom I'd like to use a custom template to query posts from a specific category. How can I achieve that query\_posts should work only after users submit the password of the page? I'm trying with this but doesn't work (page only displays header and footer) ``` <?php /* Template Name...
separate the queries for the current page and the query for all posts in a category. Untested example: ``` <?php /* Template Name: xxxx */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_header(); ?> <?php if ( post_password_required() ) : $args = array( 'cat' => 9, 'numberposts' => ...
71,716
<p>Is there a way to limit get_comments results to just the latest comment from every post?</p>
[ { "answer_id": 71715, "author": "windyjonas", "author_id": 221, "author_profile": "https://wordpress.stackexchange.com/users/221", "pm_score": 2, "selected": true, "text": "<p>separate the queries for the current page and the query for all posts in a category.<br>\nUntested example:</p>\...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71716", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Is there a way to limit get\_comments results to just the latest comment from every post?
separate the queries for the current page and the query for all posts in a category. Untested example: ``` <?php /* Template Name: xxxx */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_header(); ?> <?php if ( post_password_required() ) : $args = array( 'cat' => 9, 'numberposts' => ...
71,724
<p>I'm using a couple of custom wp_query loops on my page, the first one retrieves news from a certain category then displays a small excerpt from it with the permalink.</p> <p>The second one is another wp_query that gets a custom post type with a few advanced custom fields.</p> <p>The problem is I'd like another loo...
[ { "answer_id": 71725, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 5, "selected": true, "text": "<p>You can create any number of loops as you wish by creating more <code>WP_Query</code> objects</p>\n\n<p...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71724", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22450/" ]
I'm using a couple of custom wp\_query loops on my page, the first one retrieves news from a certain category then displays a small excerpt from it with the permalink. The second one is another wp\_query that gets a custom post type with a few advanced custom fields. The problem is I'd like another loop within the se...
You can create any number of loops as you wish by creating more `WP_Query` objects ``` $query = new WP_Query($args); while ($query->have_posts()) : // initialization for $inner_args & backup the current global $post $inner_query = new WP_Query($inner_args); while ($inner_query->have_posts()) : /...
71,736
<p>I have a gallery field using the <a href="http://www.advancedcustomfields.com/add-ons/gallery-field/" rel="nofollow">advanced custom fields gallery addon</a>.</p> <p>This is how I am outputting my gallery fields/images in my theme...</p> <pre><code>&lt;?php $images = get_field('gallery'); if( $images ): ?&gt; ...
[ { "answer_id": 71739, "author": "Jen", "author_id": 13810, "author_profile": "https://wordpress.stackexchange.com/users/13810", "pm_score": 3, "selected": true, "text": "<p>You can use Php's <a href=\"http://php.net/manual/en/function.usort.php\" rel=\"nofollow\"><code>usort()</code></a>...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71736", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11327/" ]
I have a gallery field using the [advanced custom fields gallery addon](http://www.advancedcustomfields.com/add-ons/gallery-field/). This is how I am outputting my gallery fields/images in my theme... ``` <?php $images = get_field('gallery'); if( $images ): ?> <div id="gallery-1"> <?php foreach( $imag...
You can use Php's [`usort()`](http://php.net/manual/en/function.usort.php) function with a callback. For example, if you want to sort images by ID, you could try something like this (stealing the filter that @Milo used in their answer): ``` <?php function sort_callback($a,$b) { if ($a['id'] == $b['id']) { retur...
71,743
<p>I've searched high and low for the answer - the codex on <code>wp_enqueue_script</code> seems pretty simple.</p> <p>The problem is when I add my custom excerpt script to my functions file, register and then enqueue it (set to place in header), the source is displayed in the header as:</p> <pre><code>&lt;script src...
[ { "answer_id": 71746, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 2, "selected": false, "text": "<p>No, that's not right. Your script is located at <code>http://www.olliedaw.co.uk/wp-content/themes/Daw%20Refrigeratio...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71743", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23373/" ]
I've searched high and low for the answer - the codex on `wp_enqueue_script` seems pretty simple. The problem is when I add my custom excerpt script to my functions file, register and then enqueue it (set to place in header), the source is displayed in the header as: ``` <script src="http://www.olliedaw.co.uk/wp-cont...
No, that's not right. Your script is located at `http://www.olliedaw.co.uk/wp-content/themes/Daw%20Refrigeration%20Milk%20Tanks/js/excerpt.js` and you're enqueueing `http://www.olliedaw.co.uk/wp-content/themes/DawRefrigerationMilkTanks/js/excerpt.js` ... those are not the same file! This happens often when you have sp...
71,754
<p>I am using this code to reorder the positions of the menu items for BuddyPress profile. I am using the xprofile (not sure if that makes a difference). Here is the code that I am trying to use:</p> <pre><code>&lt;?php /* Plugin name: BP custom Plugin URI: http://pittbullweb.com Description: Customs for Buddy Press V...
[ { "answer_id": 71839, "author": "henrywright", "author_id": 22599, "author_profile": "https://wordpress.stackexchange.com/users/22599", "pm_score": 0, "selected": false, "text": "<p>An easy approach would be to rename your function, this way you won't be re-declaring an already existing ...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71754", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8337/" ]
I am using this code to reorder the positions of the menu items for BuddyPress profile. I am using the xprofile (not sure if that makes a difference). Here is the code that I am trying to use: ``` <?php /* Plugin name: BP custom Plugin URI: http://pittbullweb.com Description: Customs for Buddy Press Version: 0.1 Autho...
It looks like you have the function both in bp-custom.php and in your plugin. You don't need a plugin. Put your code in plugins/bp-custom.php only. Or in your-theme/functions.php
71,759
<p>I know how to retrieve the rss2 feed from a category in wp, namely adding <code>/feed</code> behind the category name. However when I do this, not all entries from that feed are included in the rss, this is because I set the feed restriction to be 50 at the admin backend.</p> <p>I would like to know if a feed lengt...
[ { "answer_id": 72381, "author": "Stephen Harris", "author_id": 9364, "author_profile": "https://wordpress.stackexchange.com/users/9364", "pm_score": 4, "selected": true, "text": "<p>You <em>should</em> be able to use <code>pre_get_posts</code> and set the <code>posts_per_page</code> to 5...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71759", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23380/" ]
I know how to retrieve the rss2 feed from a category in wp, namely adding `/feed` behind the category name. However when I do this, not all entries from that feed are included in the rss, this is because I set the feed restriction to be 50 at the admin backend. I would like to know if a feed length could be set indivi...
You *should* be able to use `pre_get_posts` and set the `posts_per_page` to 50 conditionally (on being feed for categories). Unfortunately there is this [unresolved trac ticket](http://core.trac.wordpress.org/ticket/17853). The only work-around is to do hook into `post_limits` and replace the `LIMIT` part of the SQL q...
71,761
<p>I'm creating a custom plugin which needs to display HTML with dynamically updated values.</p> <p>To illustrate, here's what I want to achieve:</p> <pre><code>&lt;h1&gt;&lt;?php print $title; ?&gt;&lt;/h1&gt; &lt;h3&gt;&lt;?php print $subtitle; ?&gt;&lt;/h3&gt; &lt;div class="description"&gt;&lt;?php print $content...
[ { "answer_id": 71765, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 2, "selected": true, "text": "<p>The various styles of mixing and matching HTML and PHP has always been a bear. Circumstances sometimes dictate th...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71761", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18173/" ]
I'm creating a custom plugin which needs to display HTML with dynamically updated values. To illustrate, here's what I want to achieve: ``` <h1><?php print $title; ?></h1> <h3><?php print $subtitle; ?></h3> <div class="description"><?php print $content; ?></div> ``` How can I define a template, pass some variables ...
The various styles of mixing and matching HTML and PHP has always been a bear. Circumstances sometimes dictate the method you use, but many developers prefer one style or another and WordPress tends to use the style in your example. Another option, which is a bit cleaner in my opinion is to make use of the heredoc syn...
71,762
<p>I'm creating a new plugin and I want to handle errors cleanly. I find the WP_Error class unwieldy so have decided to use exceptions. I am not bothered about lack of PHP 4 support. </p> <pre><code>$error = true; if ($error) { // Throw an error throw new CustomException('A custom exception'); } </code></pr...
[ { "answer_id": 72003, "author": "totels", "author_id": 23446, "author_profile": "https://wordpress.stackexchange.com/users/23446", "pm_score": 1, "selected": false, "text": "<p>When you use <code>set_exception_handler</code> it returns the name of the previous exception handler. You can ...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71762", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23381/" ]
I'm creating a new plugin and I want to handle errors cleanly. I find the WP\_Error class unwieldy so have decided to use exceptions. I am not bothered about lack of PHP 4 support. ``` $error = true; if ($error) { // Throw an error throw new CustomException('A custom exception'); } ``` What I really want to...
You can also extend expections and then catch only those that you throw. For example: ``` function do_add_my_pws_exceptions() { class PWS_Exception extends Exception {} class PWS_Init_Exception extends PWS_Exception {} } add_action('plugins_loaded', 'do_add_my_pws_exceptions'); ``` Of course, you should be ce...
71,764
<p>I have disabled comments in my wordpress site. So comments/feed url is giving 404 error. So how should I resolve these errors? doaminname/feed works fine. But domainname/comments/feed is giving error. So I want to fix that error.</p>
[ { "answer_id": 72003, "author": "totels", "author_id": 23446, "author_profile": "https://wordpress.stackexchange.com/users/23446", "pm_score": 1, "selected": false, "text": "<p>When you use <code>set_exception_handler</code> it returns the name of the previous exception handler. You can ...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71764", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22874/" ]
I have disabled comments in my wordpress site. So comments/feed url is giving 404 error. So how should I resolve these errors? doaminname/feed works fine. But domainname/comments/feed is giving error. So I want to fix that error.
You can also extend expections and then catch only those that you throw. For example: ``` function do_add_my_pws_exceptions() { class PWS_Exception extends Exception {} class PWS_Init_Exception extends PWS_Exception {} } add_action('plugins_loaded', 'do_add_my_pws_exceptions'); ``` Of course, you should be ce...
71,770
<p>I am adding a large number of custom post types and taxonomies so it is often visually clearer if I DO NOT have them all added to the admin menu's top level. Instead I would prefer to add them under an appropriate sub-menu. I have done that without too much effort with this two step approach:</p> <ol> <li>Hiding CP...
[ { "answer_id": 71771, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 2, "selected": true, "text": "<p>Have you tried <code>show_in_menu</code> instead?</p>\n\n<pre><code>register_post_type( 'companies', array(\...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71770", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16085/" ]
I am adding a large number of custom post types and taxonomies so it is often visually clearer if I DO NOT have them all added to the admin menu's top level. Instead I would prefer to add them under an appropriate sub-menu. I have done that without too much effort with this two step approach: 1. Hiding CPT using the '...
Have you tried `show_in_menu` instead? ``` register_post_type( 'companies', array( 'show_in_menu' => LG_ADMIN_MENU, 'show_ui' => true, '...', )); ```
71,772
<p>I'm working on a system that forces users (unfamiliar with wp) to choose a category before creating a new post, and then adds some appropriate html layout styling to help them. </p> <p>The following code works if they choose category "x". How can it be adapted to cope with a couple of alternative category situation...
[ { "answer_id": 71775, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 0, "selected": false, "text": "<p>Considering the nature of filters wouldn't it be better to 'filter' the output rather then writing this to the d...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71772", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22537/" ]
I'm working on a system that forces users (unfamiliar with wp) to choose a category before creating a new post, and then adds some appropriate html layout styling to help them. The following code works if they choose category "x". How can it be adapted to cope with a couple of alternative category situations? Human ...
You should have linked to the original Q&A since the beginning... Another great code from @JanFabry, btw :) > > [Force category choice before creating new post?](https://wordpress.stackexchange.com/q/14403/12615) > > > Using exactly the code provided in his answer, this is how to make the filter `default_cont...
71,776
<p>I am using the <a href="http://wordpress.org/extend/plugins/any-mobile-theme-switcher/" rel="nofollow">Any Mobile Theme Switcher</a> plugin to switch between full and mobile themes automatically.</p> <p>The only problem with it is that the 'switch to mobile site' and 'switch to full site' links takes you to the hom...
[ { "answer_id": 71775, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 0, "selected": false, "text": "<p>Considering the nature of filters wouldn't it be better to 'filter' the output rather then writing this to the d...
2012/11/06
[ "https://wordpress.stackexchange.com/questions/71776", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/961/" ]
I am using the [Any Mobile Theme Switcher](http://wordpress.org/extend/plugins/any-mobile-theme-switcher/) plugin to switch between full and mobile themes automatically. The only problem with it is that the 'switch to mobile site' and 'switch to full site' links takes you to the home page instead of the current page. ...
You should have linked to the original Q&A since the beginning... Another great code from @JanFabry, btw :) > > [Force category choice before creating new post?](https://wordpress.stackexchange.com/q/14403/12615) > > > Using exactly the code provided in his answer, this is how to make the filter `default_cont...
71,799
<p>How to resolve this warning which is shown when I use the Custom Tables plugin? Can anybody help me please</p> <blockquote> <p>Warning: Invalid argument supplied for foreach() in ..\wp-content\plugins\custom-tables\pages\show_table.php on line 378</p> </blockquote>
[ { "answer_id": 71775, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 0, "selected": false, "text": "<p>Considering the nature of filters wouldn't it be better to 'filter' the output rather then writing this to the d...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71799", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23395/" ]
How to resolve this warning which is shown when I use the Custom Tables plugin? Can anybody help me please > > Warning: Invalid argument supplied for foreach() in ..\wp-content\plugins\custom-tables\pages\show\_table.php on line 378 > > >
You should have linked to the original Q&A since the beginning... Another great code from @JanFabry, btw :) > > [Force category choice before creating new post?](https://wordpress.stackexchange.com/q/14403/12615) > > > Using exactly the code provided in his answer, this is how to make the filter `default_cont...
71,804
<p>I am working on creating a small web-app with wordpress as the framework. It allows you to input a customer and in turn sends an email to the customer with a link back to the website in order to complete a short survey.</p> <p>I have a "Customer" Custom Post Type which includes the survey questions as custom fields...
[ { "answer_id": 71806, "author": "MadCom", "author_id": 23363, "author_profile": "https://wordpress.stackexchange.com/users/23363", "pm_score": 0, "selected": false, "text": "<p>My (simple) solution would be put everything you need into </p>\n\n<pre><code>if ( ! is_user_logged_in() ){ ...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71804", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23396/" ]
I am working on creating a small web-app with wordpress as the framework. It allows you to input a customer and in turn sends an email to the customer with a link back to the website in order to complete a short survey. I have a "Customer" Custom Post Type which includes the survey questions as custom fields. I'm lock...
I think what you want is a custom rewrite rule -- specifically, a custom endpoint. This would have to live outside s2member. To start, wrap everything in a class: ``` <?php class WPSE71804 { // post type key, whatever this happens to be. const TYPE = 'customer'; // endpoint mask, 2 ^ 18 const EP = 2...
71,811
<p>I have created a custom options page for a slider that you can upload slides to. Everything works great except when trying to save the data. It will get saved and I can use it on the front end. But the options screen won't update, it will even do a flickr on the screen (I'm assuming a page refresh when it sends the ...
[ { "answer_id": 71845, "author": "s_ha_dum", "author_id": 21376, "author_profile": "https://wordpress.stackexchange.com/users/21376", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p>If the page is manually refreshed then the right content shows up, it's so weird! </p>\n</blo...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71811", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18241/" ]
I have created a custom options page for a slider that you can upload slides to. Everything works great except when trying to save the data. It will get saved and I can use it on the front end. But the options screen won't update, it will even do a flickr on the screen (I'm assuming a page refresh when it sends the for...
> > If the page is manually refreshed then the right content shows up, it's so weird! > > > I am pretty sure this is the problem, and its not that weird. If you update with AJAX (in your case with jQuery/Javascript) the generated page-- the page in the browser-- is not going to reflect any changes unless your J...
71,813
<p>I've created a portfolio with single posts. When viewing the posts i'd like to show the next / previous 2 posts (portfolio items).</p> <p>Currently i'm using the following code but only shows one post:</p> <pre><code>&lt;?php $prevPost = get_previous_post(true); if($prevPost) {?&gt; &lt;?php $prevthumbnai...
[ { "answer_id": 71818, "author": "Daniel", "author_id": 12865, "author_profile": "https://wordpress.stackexchange.com/users/12865", "pm_score": 0, "selected": false, "text": "<p><code>get_previous_post()</code> and <code>get_next_post()</code> both use <code>get_adjacent_post()</code>. Th...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71813", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20548/" ]
I've created a portfolio with single posts. When viewing the posts i'd like to show the next / previous 2 posts (portfolio items). Currently i'm using the following code but only shows one post: ``` <?php $prevPost = get_previous_post(true); if($prevPost) {?> <?php $prevthumbnail = get_the_post_thumbnail($pre...
This one is not a good way to do it but it's easy to implement ``` global $post; $original = $post; $next = get_next_post(true); $prev = get_previous_post(true); $post = $next; next_post_link(); $post = $original; next_post_link(); // display current post previous_post_link(); $post = $prev; previous_post_link(); $pos...
71,814
<p>I have to search for posts that have in tags or custom fields a number(price): example 152. Each post have a price tag. How I do to search for all post greater than a price for example I need to search for all post who have a price tag of minimum 100.</p> <p>Something like /?s=keyword&amp;price>=300</p> <p>Thx</p>...
[ { "answer_id": 71818, "author": "Daniel", "author_id": 12865, "author_profile": "https://wordpress.stackexchange.com/users/12865", "pm_score": 0, "selected": false, "text": "<p><code>get_previous_post()</code> and <code>get_next_post()</code> both use <code>get_adjacent_post()</code>. Th...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71814", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23397/" ]
I have to search for posts that have in tags or custom fields a number(price): example 152. Each post have a price tag. How I do to search for all post greater than a price for example I need to search for all post who have a price tag of minimum 100. Something like /?s=keyword&price>=300 Thx
This one is not a good way to do it but it's easy to implement ``` global $post; $original = $post; $next = get_next_post(true); $prev = get_previous_post(true); $post = $next; next_post_link(); $post = $original; next_post_link(); // display current post previous_post_link(); $post = $prev; previous_post_link(); $pos...
71,855
<p>I wonder if it is possible to create a new user role and give him special limited abilities?</p> <p>I'd like to have some users who can only add events onto the calendar. They should only be able to work within events calendar taxonomy and edit add their posts but not publish them something like contributor but mor...
[ { "answer_id": 71860, "author": "Joseph Leedy", "author_id": 8554, "author_profile": "https://wordpress.stackexchange.com/users/8554", "pm_score": 4, "selected": true, "text": "<p>Yes. WordPress has robust built-in <a href=\"http://codex.wordpress.org/Roles_and_Capabilities\">Roles and C...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71855", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I wonder if it is possible to create a new user role and give him special limited abilities? I'd like to have some users who can only add events onto the calendar. They should only be able to work within events calendar taxonomy and edit add their posts but not publish them something like contributor but more limited!
Yes. WordPress has robust built-in [Roles and Capabilities](http://codex.wordpress.org/Roles_and_Capabilities) system desgined to do exactly what you are looking for. To add a new role, use the [`add_role()`](http://codex.wordpress.org/Function_Reference/add_role) function in your theme's `functions.php` or a plug-in ...
71,865
<p>I have a lot of CPT's and custom TAXs and decided to put them into a few submenus. That worked just fine. I'll explain how I did that in a moment but the problem is that when you choose a "new term" or a "new post" the Admin's sidebar menu loses track of being within a submenu and collapses the menu. This doesn't st...
[ { "answer_id": 78471, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 2, "selected": false, "text": "<p>I've answered a <a href=\"https://wordpress.stackexchange.com/q/44270/12615\">similar Question</a>. AFAIK, y...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71865", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16085/" ]
I have a lot of CPT's and custom TAXs and decided to put them into a few submenus. That worked just fine. I'll explain how I did that in a moment but the problem is that when you choose a "new term" or a "new post" the Admin's sidebar menu loses track of being within a submenu and collapses the menu. This doesn't stric...
Hmmm. I don't know what happened here. I could have sworn I'd already answered this question and closed it. In any event I used an approach based off of @brasofilo's suggestion. Basically here's all you need to do: In your PHP where you're registering the submenu use a declaration like this: ``` add_submenu_page ( LG...
71,866
<p>Is it possible to stop WP from creating the "Sample Page" and "Hello World!" post when creating a new blog?</p>
[ { "answer_id": 71867, "author": "Geert", "author_id": 4936, "author_profile": "https://wordpress.stackexchange.com/users/4936", "pm_score": 4, "selected": false, "text": "<p>Create a file <code>install.php</code> in your <code>wp-content</code> directory. In that file you declare the <co...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71866", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21110/" ]
Is it possible to stop WP from creating the "Sample Page" and "Hello World!" post when creating a new blog?
***If you're using Multisite*** The accepted answer is destructive in that it cancels all other set-up items in the overridden function. A less destructive way to do it *for multisite installs* is to delete the default content during new blog creation by hooking in to `wpmu_new_blog` ``` add_action( 'wpmu_new_blog', ...
71,873
<p>What would you recommend to use as far as manipulating the <a href="http://codex.wordpress.org/Class_Reference/WP_Admin_Bar" rel="nofollow noreferrer">admin bar</a> goes? I was thinking to just add a new admin bar node, and with CSS set a background image for the icon. Then in the node, just output the count.</p> <...
[ { "answer_id": 88875, "author": "Michael Ecklund", "author_id": 9579, "author_profile": "https://wordpress.stackexchange.com/users/9579", "pm_score": 3, "selected": true, "text": "<p>You just create the bubble (circle) with CSS, and have text site on top of it.</p>\n\n<p>Example CSS</p>\...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71873", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9579/" ]
What would you recommend to use as far as manipulating the [admin bar](http://codex.wordpress.org/Class_Reference/WP_Admin_Bar) goes? I was thinking to just add a new admin bar node, and with CSS set a background image for the icon. Then in the node, just output the count. ![enter image description here](https://i.sta...
You just create the bubble (circle) with CSS, and have text site on top of it. Example CSS ``` span.mbe-update-bubble{ position: absolute !important; top: 6px !important; left: 6px !important; -webkit-border-radius: 10px !important; -khtml-border-radius: 10px !important; -moz-border-radius: 10...
71,875
<p>I currently have a wordpress.org website on a server with a specific domain name. I would like to move it all to a server with another domain name as I have changed my company name. </p> <p>What is the best way of doing this without losing the links (Both internal links and external links going towards the site)? M...
[ { "answer_id": 88875, "author": "Michael Ecklund", "author_id": 9579, "author_profile": "https://wordpress.stackexchange.com/users/9579", "pm_score": 3, "selected": true, "text": "<p>You just create the bubble (circle) with CSS, and have text site on top of it.</p>\n\n<p>Example CSS</p>\...
2012/11/07
[ "https://wordpress.stackexchange.com/questions/71875", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16340/" ]
I currently have a wordpress.org website on a server with a specific domain name. I would like to move it all to a server with another domain name as I have changed my company name. What is the best way of doing this without losing the links (Both internal links and external links going towards the site)? Many thanks...
You just create the bubble (circle) with CSS, and have text site on top of it. Example CSS ``` span.mbe-update-bubble{ position: absolute !important; top: 6px !important; left: 6px !important; -webkit-border-radius: 10px !important; -khtml-border-radius: 10px !important; -moz-border-radius: 10...
71,886
<p>I need to move (or copy) the contents of a custom field into the main post body, replacing any existing content.</p> <p>I need to do this for a few hundred posts...Is there a quick way of doing this?</p> <p>I can manage moving values from one meta field to another in SQL, but i'm not sure how to do this with post ...
[ { "answer_id": 71906, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 2, "selected": false, "text": "<p>For SQL, the post's content is saved in \"wp_posts\" table under \"post_content\" column. When doing t...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71886", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23419/" ]
I need to move (or copy) the contents of a custom field into the main post body, replacing any existing content. I need to do this for a few hundred posts...Is there a quick way of doing this? I can manage moving values from one meta field to another in SQL, but i'm not sure how to do this with post content... If an...
For SQL, the post's content is saved in "wp\_posts" table under "post\_content" column. When doing this from phpmyadmin, you'll have to take care that you're updating only the main post & not one of it's revisions If you're looking for some wordpress based solution, the wordpress way to do it is to use [`wp_update_pos...
71,889
<p>I have a multisite Wordpress installation with 2 blogs, on different domains. One of them works fine, but I just realized that for the other, I can't access the admin area. I can log in, but when accessing /wp-admin the request never returns and eventually times out. It was working fine the last time I tried (a few ...
[ { "answer_id": 71906, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 2, "selected": false, "text": "<p>For SQL, the post's content is saved in \"wp_posts\" table under \"post_content\" column. When doing t...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71889", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1155/" ]
I have a multisite Wordpress installation with 2 blogs, on different domains. One of them works fine, but I just realized that for the other, I can't access the admin area. I can log in, but when accessing /wp-admin the request never returns and eventually times out. It was working fine the last time I tried (a few wee...
For SQL, the post's content is saved in "wp\_posts" table under "post\_content" column. When doing this from phpmyadmin, you'll have to take care that you're updating only the main post & not one of it's revisions If you're looking for some wordpress based solution, the wordpress way to do it is to use [`wp_update_pos...
71,892
<p>I'm just starting to wrap my head around custom post types and for some reason can't get any of the custom post types to display in the loop. I've found some queries online but none of them are in closed php statements and I'm not sure how to integrate them. Here's what I have:</p> <pre><code>// add custom post typ...
[ { "answer_id": 71906, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 2, "selected": false, "text": "<p>For SQL, the post's content is saved in \"wp_posts\" table under \"post_content\" column. When doing t...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71892", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31938/" ]
I'm just starting to wrap my head around custom post types and for some reason can't get any of the custom post types to display in the loop. I've found some queries online but none of them are in closed php statements and I'm not sure how to integrate them. Here's what I have: ``` // add custom post type add_action( ...
For SQL, the post's content is saved in "wp\_posts" table under "post\_content" column. When doing this from phpmyadmin, you'll have to take care that you're updating only the main post & not one of it's revisions If you're looking for some wordpress based solution, the wordpress way to do it is to use [`wp_update_pos...
71,918
<p>I'm using wordpress social login plugin. So some of my users register via facebook.</p> <p>I'm trying to hook myself to user_register and display only once upon registration and upon using facebook as source some special message.</p> <p>Wordpress social login plugin creates meta_key Facebook if user registered via...
[ { "answer_id": 71912, "author": "dipali", "author_id": 20711, "author_profile": "https://wordpress.stackexchange.com/users/20711", "pm_score": 0, "selected": false, "text": "<p>This all because of PHP has been allocated less memory.<br/>\nSo have to increase PHP memory limit.If PHP has b...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71918", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm using wordpress social login plugin. So some of my users register via facebook. I'm trying to hook myself to user\_register and display only once upon registration and upon using facebook as source some special message. Wordpress social login plugin creates meta\_key Facebook if user registered via facebook. So ...
Try going to Tools then Export and export your Wordpress site into an XML file. Then delete your Wordpress site off your web server and reinstall it. Go Tools > Import and click on import and select the XML file. Reinstalling Wordpress should fix your problem.
71,927
<p>Wordpress has a feature whereby it will automatically redirect your URLs if it percieves them to be written wrongly. Here is an example: I have a page called <code>my-page</code></p> <p>If I go to:</p> <pre><code>www.mysite.com/something/my-page/ </code></pre> <p>it will immediately redirect me to </p> <pre><cod...
[ { "answer_id": 71930, "author": "Mazatec", "author_id": 4816, "author_profile": "https://wordpress.stackexchange.com/users/4816", "pm_score": 6, "selected": true, "text": "<p>This worked for me:</p>\n\n<pre><code>remove_action('template_redirect', 'redirect_canonical');\n</code></pre>\n"...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71927", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4816/" ]
Wordpress has a feature whereby it will automatically redirect your URLs if it percieves them to be written wrongly. Here is an example: I have a page called `my-page` If I go to: ``` www.mysite.com/something/my-page/ ``` it will immediately redirect me to ``` www.mysite.com/my-page/ ``` as nothing exists at th...
This worked for me: ``` remove_action('template_redirect', 'redirect_canonical'); ```
71,928
<p>I want to get a set of posts from a CPT based on a taxonomy term being present. I thought I'd use WP's get_posts() function:</p> <blockquote> <p>$results = get_posts(array $options);</p> </blockquote> <p>This function works fine when I specify the CPT i'm interested in:</p> <blockquote> <p>$results = get_post...
[ { "answer_id": 71931, "author": "Simon Blackbourn", "author_id": 2877, "author_profile": "https://wordpress.stackexchange.com/users/2877", "pm_score": 1, "selected": false, "text": "<p>I usually use the <code>tax_query</code> parameter:</p>\n\n<pre><code>$args = array(\n 'post_type' ...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71928", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16085/" ]
I want to get a set of posts from a CPT based on a taxonomy term being present. I thought I'd use WP's get\_posts() function: > > $results = get\_posts(array $options); > > > This function works fine when I specify the CPT i'm interested in: > > $results = get\_posts( array('post\_type' => 'my\_cpt\_name') ); >...
I usually use the `tax_query` parameter: ``` $args = array( 'post_type' => 'my_cpt_name', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'uom_system', 'field' => 'slug', 'terms' => 'metric-system' ...
71,942
<p>I'm using a lookup table to define a few things for the qTranslate plugin</p> <p><strong>Table</strong></p> <pre><code>$trans_home = array('en' =&gt; 'Home','it' =&gt; 'Home','de' =&gt; 'Home','zh' =&gt; '首页','es' =&gt; 'Página de inicio','fr' =&gt; 'Page d\'accueil'); $trans_company = array('en' =&gt; 'Company','...
[ { "answer_id": 71931, "author": "Simon Blackbourn", "author_id": 2877, "author_profile": "https://wordpress.stackexchange.com/users/2877", "pm_score": 1, "selected": false, "text": "<p>I usually use the <code>tax_query</code> parameter:</p>\n\n<pre><code>$args = array(\n 'post_type' ...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71942", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1859/" ]
I'm using a lookup table to define a few things for the qTranslate plugin **Table** ``` $trans_home = array('en' => 'Home','it' => 'Home','de' => 'Home','zh' => '首页','es' => 'Página de inicio','fr' => 'Page d\'accueil'); $trans_company = array('en' => 'Company','it' => 'L\'azienda','de' => 'Firma','zh' => '公司','es' =...
I usually use the `tax_query` parameter: ``` $args = array( 'post_type' => 'my_cpt_name', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'uom_system', 'field' => 'slug', 'terms' => 'metric-system' ...
71,951
<p>Has anyone used the "WooCommerce Layered Nav" widget. I wonder if the attributes could be visible on the single product page?</p>
[ { "answer_id": 71931, "author": "Simon Blackbourn", "author_id": 2877, "author_profile": "https://wordpress.stackexchange.com/users/2877", "pm_score": 1, "selected": false, "text": "<p>I usually use the <code>tax_query</code> parameter:</p>\n\n<pre><code>$args = array(\n 'post_type' ...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71951", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22843/" ]
Has anyone used the "WooCommerce Layered Nav" widget. I wonder if the attributes could be visible on the single product page?
I usually use the `tax_query` parameter: ``` $args = array( 'post_type' => 'my_cpt_name', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'uom_system', 'field' => 'slug', 'terms' => 'metric-system' ...
71,957
<p>How do I get the height and width of default image sizes? I am not talking about custom image sizes, which can be retrieved from get_intermediate_image_sizes(). I want to get size attribute for 'thumbnail', 'medium', and 'large'.</p> <p><strong>Update</strong> Base on answer by Mridul Aggarwal, looks like i can d...
[ { "answer_id": 71962, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 2, "selected": false, "text": "<p>If you want to get those set in the admin panel, use the function <code>get_option</code>. The keys ar...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71957", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12388/" ]
How do I get the height and width of default image sizes? I am not talking about custom image sizes, which can be retrieved from get\_intermediate\_image\_sizes(). I want to get size attribute for 'thumbnail', 'medium', and 'large'. **Update** Base on answer by Mridul Aggarwal, looks like i can do: ``` function get_i...
If you want to get those set in the admin panel, use the function `get_option`. The keys are ``` get_option('thumbnail_size_w'); get_option('thumbnail_size_h'); get_option('medium_size_w'); get_option('medium_size_h'); get_option('large_size_w'); get_option('large_size_h'); ``` If you want them for some specific att...
71,960
<p>I am working on a wordpress site for a client who wants an internal 'intranet' for his employees. The basic needs are:</p> <ol> <li>Communicate things in-house</li> <li>House important company documents</li> <li>Provide quick access to resources to employees.</li> </ol> <p>This info is sensitive and for employees...
[ { "answer_id": 71965, "author": "Rezen", "author_id": 8191, "author_profile": "https://wordpress.stackexchange.com/users/8191", "pm_score": 1, "selected": false, "text": "<p>You can set content visibility to private on specific pages and that would require visitors to have a WordPress lo...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71960", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5861/" ]
I am working on a wordpress site for a client who wants an internal 'intranet' for his employees. The basic needs are: 1. Communicate things in-house 2. House important company documents 3. Provide quick access to resources to employees. This info is sensitive and for employees only. They would like each employee to ...
This is just a modification of [timshutes' answer](https://wordpress.stackexchange.com/a/109184/37384) - if you want specific pages to require login and don't want to put them into a custom post type, you can add to functions.php: ``` add_shortcode('need_login', 'shortcode_needLogin'); function shortcode_needLogin() ...
71,961
<p>So this PHP code works for me:</p> <pre><code> $ch = curl_init( TCS_CPDF_REMOTE_ZIP ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $data = curl_exec( $ch ); curl_close( $ch ); file_put_contents( TCS_CPDF_LOCAL_ZIP, $data ); </code></pre> <p>but when trying to use the WordPress HTTP API:</p...
[ { "answer_id": 71964, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 4, "selected": true, "text": "<p>Check out <a href=\"http://codex.wordpress.org/Function_Reference/download_url\"><code>download_url()</code>...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71961", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4610/" ]
So this PHP code works for me: ``` $ch = curl_init( TCS_CPDF_REMOTE_ZIP ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $data = curl_exec( $ch ); curl_close( $ch ); file_put_contents( TCS_CPDF_LOCAL_ZIP, $data ); ``` but when trying to use the WordPress HTTP API: ``` $the_body = wp_remo...
Check out [`download_url()`](http://codex.wordpress.org/Function_Reference/download_url) - it's only loaded in the admin, so you'll have to include it (or write your own) if needed on the front-end. From `download_url()` you can use: ``` $response = wp_remote_get( TCS_CPDF_REMOTE_ZIP, array( 'timeo...
71,988
<p>I created a custom loop in the page admin section to manage a custom post type called "widgets" for that page.</p> <pre><code>$ps_widget_list = get_post_meta( $post_id, 'ps_widget_list', true ); //first get the list of current widgets $active_widget_array = explode( ', ', $ps_widget_list ); //then separate those w...
[ { "answer_id": 71990, "author": "pete_schuster", "author_id": 1388, "author_profile": "https://wordpress.stackexchange.com/users/1388", "pm_score": 1, "selected": false, "text": "<p>Switched the loop from using to WP_Query to get_posts.</p>\n" }, { "answer_id": 91714, "author...
2012/11/08
[ "https://wordpress.stackexchange.com/questions/71988", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1388/" ]
I created a custom loop in the page admin section to manage a custom post type called "widgets" for that page. ``` $ps_widget_list = get_post_meta( $post_id, 'ps_widget_list', true ); //first get the list of current widgets $active_widget_array = explode( ', ', $ps_widget_list ); //then separate those widgets into an...
Switched the loop from using to WP\_Query to get\_posts.