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 |
|---|---|---|---|---|---|---|
240,679 | <p>here is my option page:
<pre><code>class PriceListOptions {
private $price_list_options_options;
public function __construct() {
add_action( 'admin_menu', array( $this, 'price_list_options_add_plugin_page' ) );
add_action( 'admin_init', array( $this, 'price_list_options_page_init' ) );
}
public funct... | [
{
"answer_id": 240754,
"author": "bosco",
"author_id": 25324,
"author_profile": "https://wordpress.stackexchange.com/users/25324",
"pm_score": 2,
"selected": false,
"text": "<p>Missing GET request variables are sometimes a symptom of improper rewrite rules in the web-server's configurati... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240679",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103709/"
] | here is my option page:
```
class PriceListOptions {
private $price_list_options_options;
public function __construct() {
add_action( 'admin_menu', array( $this, 'price_list_options_add_plugin_page' ) );
add_action( 'admin_init', array( $this, 'price_list_options_page_init' ) );
}
public function price_list_... | Missing GET request variables are sometimes a symptom of improper rewrite rules in the web-server's configuration files. In the case of Apache, rewrites are most often implemented using the [`mod_rewrite`](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) module's directives in the WordPress installation's dir... |
240,682 | <p>I have set up a custom loop to display featured products at the top of their relevant category pages.</p>
<p>but now I would like to go about removing featured products from the regular loop below, which is using the standard woocommerce code to display products,</p>
<p>Any help would be greatly appreciated</p>
<... | [
{
"answer_id": 240754,
"author": "bosco",
"author_id": 25324,
"author_profile": "https://wordpress.stackexchange.com/users/25324",
"pm_score": 2,
"selected": false,
"text": "<p>Missing GET request variables are sometimes a symptom of improper rewrite rules in the web-server's configurati... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240682",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103636/"
] | I have set up a custom loop to display featured products at the top of their relevant category pages.
but now I would like to go about removing featured products from the regular loop below, which is using the standard woocommerce code to display products,
Any help would be greatly appreciated
<http://onthesquareauc... | Missing GET request variables are sometimes a symptom of improper rewrite rules in the web-server's configuration files. In the case of Apache, rewrites are most often implemented using the [`mod_rewrite`](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) module's directives in the WordPress installation's dir... |
240,695 | <p>I am tryping to fetch random posts list in single.php above footer.
Titles of the post displaying randomly and are unique in <code><li></code> but the excerpt is same for every post title (i.e., same excerpt of post content 'single.php').</p>
<p>First tried this:</p>
<pre><code> <ul class="random-list"&g... | [
{
"answer_id": 240696,
"author": "Sladix",
"author_id": 27423,
"author_profile": "https://wordpress.stackexchange.com/users/27423",
"pm_score": 1,
"selected": false,
"text": "<p>You are trying to use the_title() and the_excerpt() functions outside the <a href=\"https://codex.wordpress.or... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240695",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/102355/"
] | I am tryping to fetch random posts list in single.php above footer.
Titles of the post displaying randomly and are unique in `<li>` but the excerpt is same for every post title (i.e., same excerpt of post content 'single.php').
First tried this:
```
<ul class="random-list">
<?php $posts = get_posts('orderby=ran... | You are trying to use the\_title() and the\_excerpt() functions outside the [wordpress loop](https://codex.wordpress.org/The_Loop), therefore, they will not work.
I suggest you try something like :
```
$args = array( 'posts_per_page' => 12, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
$query = new... |
240,701 | <p>I'm using an <code><input></code> tag that stores the values of multiple attachment image ids and it's not working.</p>
<p>Can anyone tell me where the problem is?</p>
<pre><code><input type="hidden" name="jfiler-items-exclude-imgid" value="["4602","4603"]">
if (isset($_POST['jfiler-items-exclude-imgid... | [
{
"answer_id": 240696,
"author": "Sladix",
"author_id": 27423,
"author_profile": "https://wordpress.stackexchange.com/users/27423",
"pm_score": 1,
"selected": false,
"text": "<p>You are trying to use the_title() and the_excerpt() functions outside the <a href=\"https://codex.wordpress.or... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240701",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103723/"
] | I'm using an `<input>` tag that stores the values of multiple attachment image ids and it's not working.
Can anyone tell me where the problem is?
```
<input type="hidden" name="jfiler-items-exclude-imgid" value="["4602","4603"]">
if (isset($_POST['jfiler-items-exclude-imgid'])) {
$att_ids = $_POST['jfiler-items-e... | You are trying to use the\_title() and the\_excerpt() functions outside the [wordpress loop](https://codex.wordpress.org/The_Loop), therefore, they will not work.
I suggest you try something like :
```
$args = array( 'posts_per_page' => 12, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
$query = new... |
240,708 | <p>I am currently using the .htaccess file in cPanel to password protect my Wordpress website. There are a list of whitelisted IP addresses that can bypass the login form. </p>
<p>I would like to whitelist a page, but I don't have a .php or .html file to whitelist. It is a page within Wordpress, so I realize I may hav... | [
{
"answer_id": 240718,
"author": "Greg McMullen",
"author_id": 36028,
"author_profile": "https://wordpress.stackexchange.com/users/36028",
"pm_score": 1,
"selected": false,
"text": "<p>If you are just wanting a simple \"login\" you could use <code>htpasswd</code> and <code>htaccess</code... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240708",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/97431/"
] | I am currently using the .htaccess file in cPanel to password protect my Wordpress website. There are a list of whitelisted IP addresses that can bypass the login form.
I would like to whitelist a page, but I don't have a .php or .html file to whitelist. It is a page within Wordpress, so I realize I may have to find ... | If you are just wanting a simple "login" you could use `htpasswd` and `htaccess`. WordPress sites already have the `htaccess` in the main directory.
Add an `.htpasswd` file at the same level as your root HTML folder. Example:
```
.
├── public_html
| └── wordpress
| └── .htaccess
└── .htpasswd
```
Use a tool... |
240,741 | <p>The home page of my site is set to show the 9 latest posts (via the setting in the admin area), and then at the bottom I have the standard pagination links which allow visitors to view more posts. </p>
<p>I would like to have the home page (and only the home page) show 7 latest posts, but then on the subsequent pag... | [
{
"answer_id": 240756,
"author": "Ahmed Fouad",
"author_id": 102371,
"author_profile": "https://wordpress.stackexchange.com/users/102371",
"pm_score": 2,
"selected": true,
"text": "<p>Ok this was really tricky. I have so far managed to work around it by lying to the WordPress global <cod... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240741",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/69134/"
] | The home page of my site is set to show the 9 latest posts (via the setting in the admin area), and then at the bottom I have the standard pagination links which allow visitors to view more posts.
I would like to have the home page (and only the home page) show 7 latest posts, but then on the subsequent pages - 2, 3,... | Ok this was really tricky. I have so far managed to work around it by lying to the WordPress global `$wp_query`. Here is how.
In your theme's `functions.php` you can add these functions to show 7 posts on first page, and 9 posts on any other page.
Okay, that code works so far but you'll notice that the pagination is ... |
240,743 | <p>I have a small filter below. It does a regular expression replace of a particular string when the user saves the draft.</p>
<p>However, using this filter causes the warning "The backup of this post in your browser is different from the version below."</p>
<p>Is there a way to 'tell' Wordpress not to display the wa... | [
{
"answer_id": 240780,
"author": "Rishabh",
"author_id": 81621,
"author_profile": "https://wordpress.stackexchange.com/users/81621",
"pm_score": -1,
"selected": false,
"text": "<p>The possible reason of getting warning can be solved from your <code>wp-config.php</code> file. Check if in ... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240743",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17248/"
] | I have a small filter below. It does a regular expression replace of a particular string when the user saves the draft.
However, using this filter causes the warning "The backup of this post in your browser is different from the version below."
Is there a way to 'tell' Wordpress not to display the warning when that f... | The way to avoid this error is to make sure the `wp-saving-post` cookie is being set to a value of `[post id]-saved`, as seen [here](https://github.com/WordPress/WordPress/blob/10970701d7fbcaf504dd7d35d0e75c5c2b0c2e52/wp-includes/js/autosave.js#L457). As you can see, if that occurs, then WordPress won't complain about ... |
240,744 | <p>I am trying to make a page that displays a <em><a href="https://codex.wordpress.org/Post_Types#Custom_Post_Types" rel="nofollow">Custom Post Type</a></em>.</p>
<p>I need for all post to be displayed twice. Once at a list of products and once as a modal. I am able to display the product list on the page but I can't ... | [
{
"answer_id": 240759,
"author": "rudtek",
"author_id": 77767,
"author_profile": "https://wordpress.stackexchange.com/users/77767",
"pm_score": 1,
"selected": false,
"text": "<p>more than just resetting post data i would reset the whole query:</p>\n\n<pre><code> wp_reset_query(); // Re... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240744",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103751/"
] | I am trying to make a page that displays a *[Custom Post Type](https://codex.wordpress.org/Post_Types#Custom_Post_Types)*.
I need for all post to be displayed twice. Once at a list of products and once as a modal. I am able to display the product list on the page but I can't get the second post query for the modals to... | You can Query a lot of time in the same page and all the query that you execute will work perfect irrespective of the custom post type that you choose.
>
> Note: Once after you finish the Wp\_Query at the first time you need to `reset` the `Wp_Query` after the execution of the code.
>
>
>
```
wp_reset_query(); //... |
240,745 | <p>I have a WordPress installation on a bad server that I want to migrate.</p>
<p>I tried to make a backup via some WordPress plugins, but it was taking forever, generating an enormous zip file.</p>
<p>I asked help from my host support but they haven't replied since.</p>
<p>Looking for a solution I found a <code>www... | [
{
"answer_id": 240815,
"author": "junkrig",
"author_id": 54989,
"author_profile": "https://wordpress.stackexchange.com/users/54989",
"pm_score": 1,
"selected": false,
"text": "<p>Do you have any access to the server? SSH access? If you can get to a command line on the server you could tr... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240745",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103173/"
] | I have a WordPress installation on a bad server that I want to migrate.
I tried to make a backup via some WordPress plugins, but it was taking forever, generating an enormous zip file.
I asked help from my host support but they haven't replied since.
Looking for a solution I found a `www` symlink inside the `www` fo... | Do you have any access to the server? SSH access? If you can get to a command line on the server you could try one of these commands. Using sudo would try and run the command as an administrator, so you would need a password:
```
unlink /path/to/symlink
sudo unlink /path/to/symlink
rm /path/to/symlink
sudo rm /pat... |
240,746 | <p>I would like to show published time "Posted 4:15pm" for the first 24 hours, after 24hours show full published date and time "September 27, 2016 at 4:15pm"</p>
<p>Any suggestions? Thanks in advance</p>
| [
{
"answer_id": 240749,
"author": "user103760",
"author_id": 103760,
"author_profile": "https://wordpress.stackexchange.com/users/103760",
"pm_score": 0,
"selected": false,
"text": "<p>So far :</p>\n\n<pre><code>function ci_posted_on() {\n$time_string = '<time itemprop=\"datePublished\... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240746",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103759/"
] | I would like to show published time "Posted 4:15pm" for the first 24 hours, after 24hours show full published date and time "September 27, 2016 at 4:15pm"
Any suggestions? Thanks in advance | This should do it.
```
// See if the post is older than 24 hours.
if ( get_post_time() <= strtotime( '-1 day' ) ) {
echo 'Published more than 24 hours ago.';
} else {
echo 'Published within the last 24 hours.';
}
``` |
240,762 | <p>I am trying to create a shortcode to display the posts count in a category.
I have successfully done this using this code:</p>
<pre><code>// Add Shortcode to show posts count inside a category
function add_count_of_posts_in_category() {
$term = get_term( 7, 'category' );
$count = $term->count;
echo $count;
}
ad... | [
{
"answer_id": 240763,
"author": "Ahmed Fouad",
"author_id": 102371,
"author_profile": "https://wordpress.stackexchange.com/users/102371",
"pm_score": 3,
"selected": true,
"text": "<h3>The shortcode</h3>\n\n<pre><code>// Add Shortcode to show posts count inside a category\nfunction categ... | 2016/09/27 | [
"https://wordpress.stackexchange.com/questions/240762",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/91570/"
] | I am trying to create a shortcode to display the posts count in a category.
I have successfully done this using this code:
```
// Add Shortcode to show posts count inside a category
function add_count_of_posts_in_category() {
$term = get_term( 7, 'category' );
$count = $term->count;
echo $count;
}
add_shortcode( 'sho... | ### The shortcode
```
// Add Shortcode to show posts count inside a category
function category_post_count( $atts ) {
$atts = shortcode_atts( array(
'category' => null
), $atts );
// get the category by slug.
$term = get_term_by( 'slug', $atts['category'], 'category');
return ( isset( $te... |
240,765 | <p>I want to delete all the resized images while leaving the original image. I have more than 20 GB of unused data taking up room on the server. For example:</p>
<ul>
<li>first-image-name.jpg</li>
<li>first-image-name-72x72.jpg</li>
<li>first-image-name-150x150.jpg</li>
<li>first-image-name-250x250.jpg</li>
<li>first-... | [
{
"answer_id": 240773,
"author": "mukto90",
"author_id": 57944,
"author_profile": "https://wordpress.stackexchange.com/users/57944",
"pm_score": 2,
"selected": false,
"text": "<p>No idea, how to remove existing images. But you can stop generating image sizes for new images you are going ... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240765",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103757/"
] | I want to delete all the resized images while leaving the original image. I have more than 20 GB of unused data taking up room on the server. For example:
* first-image-name.jpg
* first-image-name-72x72.jpg
* first-image-name-150x150.jpg
* first-image-name-250x250.jpg
* first-image-name-300x300.jpg
* first-image-name-... | A majority of the answers covered how to stop creating future default image sizes but this doesnt account for creating any custom sizes in your theme but here is another solution to add to `functions.php`:
```
function wpse_240765_unset_images( $sizes ){
unset( $sizes[ 'thumbnail' ]);
unset( $sizes[ 'medium' ]... |
240,800 | <p>Good morning,
actually i'm going to start with a new entrepreneur project and I'm thinking about build the website in Wordpress but I'll need to upload many GB of video everyday. There's some limit about the upload or the quality of the video?
Will I be able to upload also from a FTP like Filezilla?</p>
<p>Thanks<... | [
{
"answer_id": 240773,
"author": "mukto90",
"author_id": 57944,
"author_profile": "https://wordpress.stackexchange.com/users/57944",
"pm_score": 2,
"selected": false,
"text": "<p>No idea, how to remove existing images. But you can stop generating image sizes for new images you are going ... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240800",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103801/"
] | Good morning,
actually i'm going to start with a new entrepreneur project and I'm thinking about build the website in Wordpress but I'll need to upload many GB of video everyday. There's some limit about the upload or the quality of the video?
Will I be able to upload also from a FTP like Filezilla?
Thanks | A majority of the answers covered how to stop creating future default image sizes but this doesnt account for creating any custom sizes in your theme but here is another solution to add to `functions.php`:
```
function wpse_240765_unset_images( $sizes ){
unset( $sizes[ 'thumbnail' ]);
unset( $sizes[ 'medium' ]... |
240,811 | <p>The first query is working fine individually. Vouchers have a day, a start time and an end time. I'm grabbing the current time (e.g 11:10) and trying to show posts where the <code>$time_now</code> comes BETWEEN the <code>start_time</code> and <code>end_time</code>. Are you not able to pass an array into the <code>ke... | [
{
"answer_id": 240823,
"author": "Ahmed Fouad",
"author_id": 102371,
"author_profile": "https://wordpress.stackexchange.com/users/102371",
"pm_score": 1,
"selected": false,
"text": "<p>Can you please try the following <code>$args</code></p>\n\n<pre><code>$today = date('l');\n$time_now = ... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240811",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103807/"
] | The first query is working fine individually. Vouchers have a day, a start time and an end time. I'm grabbing the current time (e.g 11:10) and trying to show posts where the `$time_now` comes BETWEEN the `start_time` and `end_time`. Are you not able to pass an array into the `key`?
```
$today = date('l');
$time_now = ... | In addition to the suggestion by @AhmedMahdi to solve your problem, here's the narrower answer to your question: Nope, `key` cannot be an array. As you can see in the [specs of WP\_Meta\_Query](https://codex.wordpress.org/Class_Reference/WP_Meta_Query) `key` must be a string. |
240,834 | <p>Recently Themeforest Ask all the new developers to Add Custom Post Type Throught Plugin.. My question is
I have testimonial.php Custom Post Type With Meta Boxes</p>
<pre><code><?php
function register_testimonial() {
$labels = array(
'name' => 'Testimonial',
'singular_name'... | [
{
"answer_id": 240842,
"author": "xWaZzo",
"author_id": 95090,
"author_profile": "https://wordpress.stackexchange.com/users/95090",
"pm_score": 0,
"selected": false,
"text": "<p>You need to move this out of your theme into a new folder (The plugin folder) and add the next lines to the be... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240834",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103817/"
] | Recently Themeforest Ask all the new developers to Add Custom Post Type Throught Plugin.. My question is
I have testimonial.php Custom Post Type With Meta Boxes
```
<?php
function register_testimonial() {
$labels = array(
'name' => 'Testimonial',
'singular_name' => 'Testimonial',
... | i agree with the other answers, but neither addressed flushing the re-write rules. If you don't add this, it will confuse your users when they activate the plugin and still can't access the custom postypes on the front.
The other problem you're going to have is that LOTS of people will use testimonials so if your clie... |
240,836 | <p>I am having to update a website for someone that was built with one of those (not very nice, clunky) pre-made themes. The theme (it's the parent theme, actually, called Mineral) inserts a meta box in all of the post and page edit pages of the site with various layout options. </p>
<p>I want to hide this though for ... | [
{
"answer_id": 240841,
"author": "Benoti",
"author_id": 58141,
"author_profile": "https://wordpress.stackexchange.com/users/58141",
"pm_score": 0,
"selected": false,
"text": "<p>You can try to hook your function with admin_init.</p>\n\n<pre><code>add_action('admin_init', 'remove_page_exc... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240836",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/28543/"
] | I am having to update a website for someone that was built with one of those (not very nice, clunky) pre-made themes. The theme (it's the parent theme, actually, called Mineral) inserts a meta box in all of the post and page edit pages of the site with various layout options.
I want to hide this though for various pa... | **Remove WordPress Meta Boxes**
You have to make use of the function called `remove meta box`.
**Description:**
Removes a meta box or any other element from a particular post edit screen of a given post type. It can be also used to remove a widget from the dashboard screen.
>
> Steps to remove the meta box from Wo... |
240,838 | <p>I have a CPT named “football_fixture”.This CPT has taxonomy named “competition”, and this taxonomy has different terms , laliga, eng.
I want to show my post as follow:<br>
laliga:<br>
List of all posts published including above terms.<br>
eng:<br>
List of all posts published including above terms.<br>
I am using fol... | [
{
"answer_id": 240849,
"author": "Aurovrata",
"author_id": 52120,
"author_profile": "https://wordpress.stackexchange.com/users/52120",
"pm_score": 1,
"selected": false,
"text": "<p>You need to <a href=\"https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters\" rel=\"nofo... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240838",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/83330/"
] | I have a CPT named “football\_fixture”.This CPT has taxonomy named “competition”, and this taxonomy has different terms , laliga, eng.
I want to show my post as follow:
laliga:
List of all posts published including above terms.
eng:
List of all posts published including above terms.
I am using following ... | In your custom templates, First you have to fetch all terms for your custom post type.
You can use [get\_terms](https://developer.wordpress.org/reference/functions/get_terms/) to retrive terms in taxonomy
If you are using wordpress prior to 4.5
```
$terms = get_terms( 'competition' , array(
'hide_empty' => false... |
240,844 | <p>I have a theme which appears to have broken previewing posts. When I preview a page/post I get a 404 error.</p>
<p>If I change to another theme previews work fine again so it must be something in this theme.</p>
<p>I can't work out when/if I would have broken previews. Going through my filters and actions I can't ... | [
{
"answer_id": 240869,
"author": "italiansoda",
"author_id": 71608,
"author_profile": "https://wordpress.stackexchange.com/users/71608",
"pm_score": 1,
"selected": false,
"text": "<p>This is just a shot in the dark without knowing more like sMyles said. Try saving (flushing) your permali... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240844",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/85357/"
] | I have a theme which appears to have broken previewing posts. When I preview a page/post I get a 404 error.
If I change to another theme previews work fine again so it must be something in this theme.
I can't work out when/if I would have broken previews. Going through my filters and actions I can't see anything obvi... | I found the answer.
It was only for post-formats on pages. The issue was that I needed to also register the taxonomy `post_format` on pages as well in the init action.
I have updated the wiki page to reflect this.
<https://codex.wordpress.org/Post_Formats#Adding_Post_Type_Support>
```
// add post-formats to post_typ... |
240,854 | <p>The value of the field it is checking is '25000' and I want to check that the value in the variable is less than or equal to this meta field.</p>
<p>This is working fine in the most part for any number above 10000 but anything below this it doesn't bring the results back.</p>
<p>I am trying to figure out what the ... | [
{
"answer_id": 240859,
"author": "Aamer Shahzad",
"author_id": 42772,
"author_profile": "https://wordpress.stackexchange.com/users/42772",
"pm_score": 0,
"selected": false,
"text": "<p>use relation inside <code>meta_query</code> <code>'relation' => 'OR',</code></p>\n\n<pre><code>$args... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240854",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/102637/"
] | The value of the field it is checking is '25000' and I want to check that the value in the variable is less than or equal to this meta field.
This is working fine in the most part for any number above 10000 but anything below this it doesn't bring the results back.
I am trying to figure out what the issue is here, an... | In order to deliver the amount variable to be less than 25000 you need to check the query with the operator called `<=` but you have tested it with `>=` in your query.
**Note:** There are several comparison operators available
```
= equals
!= does not equal
> greater than
>= greater than or equal to
< less th... |
240,856 | <p>Somewhat of a weird problem: </p>
<p>I have a post loop that display the three most recent posts from specific categories. It seems to work, except the post url is not being returned. It returns just the root url 'localhost:8888'. Any help would be appreciated!</p>
<pre><code> <?php $posts = get_posts( "cate... | [
{
"answer_id": 240867,
"author": "Naresh Kumar P",
"author_id": 101025,
"author_profile": "https://wordpress.stackexchange.com/users/101025",
"pm_score": 2,
"selected": false,
"text": "<p>You have made the mistake in getting the post link in your code.</p>\n\n<p><strong>Missing</strong><... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240856",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101935/"
] | Somewhat of a weird problem:
I have a post loop that display the three most recent posts from specific categories. It seems to work, except the post url is not being returned. It returns just the root url 'localhost:8888'. Any help would be appreciated!
```
<?php $posts = get_posts( "category=17,12,35,23,24,25,1... | You have made the mistake in getting the post link in your code.
**Missing**
1. `<?php global $post; ?>` - Initialization at the start of the loop
>
> After setting up the post data your query becomes like normal `Wp_Query` so that you can get the `permalink()` in normal method itself using `the_permalink()` instea... |
240,858 | <p>I made some researches for my question, but found nothing.</p>
<p>I have a query that gets all posts from a specific post type and where a specific custom field is not empty. But I would like that this same custom field has a max characters' length. And I don't want to trim the value, I only want to get posts that ... | [
{
"answer_id": 240867,
"author": "Naresh Kumar P",
"author_id": 101025,
"author_profile": "https://wordpress.stackexchange.com/users/101025",
"pm_score": 2,
"selected": false,
"text": "<p>You have made the mistake in getting the post link in your code.</p>\n\n<p><strong>Missing</strong><... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240858",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103829/"
] | I made some researches for my question, but found nothing.
I have a query that gets all posts from a specific post type and where a specific custom field is not empty. But I would like that this same custom field has a max characters' length. And I don't want to trim the value, I only want to get posts that have a cha... | You have made the mistake in getting the post link in your code.
**Missing**
1. `<?php global $post; ?>` - Initialization at the start of the loop
>
> After setting up the post data your query becomes like normal `Wp_Query` so that you can get the `permalink()` in normal method itself using `the_permalink()` instea... |
240,861 | <p>In my wordpress theme i m trying to print multiple <code>custom fields</code> of posts with ajax. First i get <code>title</code> of post with ajax live search correctly, now need to show post data after click on any post title.</p>
<p>After <code>Click</code> on any <code>title</code> in live search it show custom ... | [
{
"answer_id": 240866,
"author": "scott",
"author_id": 93587,
"author_profile": "https://wordpress.stackexchange.com/users/93587",
"pm_score": 0,
"selected": false,
"text": "<p>It appears you are not capturing the event when a search result is clicked. Your code for each search result is... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240861",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/97572/"
] | In my wordpress theme i m trying to print multiple `custom fields` of posts with ajax. First i get `title` of post with ajax live search correctly, now need to show post data after click on any post title.
After `Click` on any `title` in live search it show custom field for that post on same page??
**HTML:**
```
<h2... | I'm not sure Why you used loop to display your post meta. and you code are all ok but you have to change little-bit.
***Q***. *Why you used inline script ? On my opinion you should used external script file to do this.*
anyway that's not the main issue here. In order to work with click function with ajax generate co... |
240,877 | <p>We have a situation where the users (children) keep not forgetting their password but making trivial mistakes while trying to login.<br>
As per question they should be first redirected to page e.g. id=5 with instructions like: </p>
<blockquote>
<p>Please go back and:<br>
Activate your cookies<br>
Check if th... | [
{
"answer_id": 240885,
"author": "mmm",
"author_id": 74311,
"author_profile": "https://wordpress.stackexchange.com/users/74311",
"pm_score": 0,
"selected": false,
"text": "<p>the action <code>login_form_lostpassword</code> is called before the lost password page. try this : </p>\n\n<pre>... | 2016/09/28 | [
"https://wordpress.stackexchange.com/questions/240877",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17797/"
] | We have a situation where the users (children) keep not forgetting their password but making trivial mistakes while trying to login.
As per question they should be first redirected to page e.g. id=5 with instructions like:
>
> Please go back and:
>
> Activate your cookies
>
> Check if the correct language... | This is straightforward.
1. Hook on init to detect the lostpassword page
2. If the user is not coming from your instructions page (which we defined by adding extra query parameter) he'll be redirected to your custom page
3. In your custom page add the link to lost password page including the extra parameter we set to ... |
240,914 | <p>Wordpress 4.4 indroduced a way to display the genitive case of a months name for specific locale by using the function <code>date_i18n</code> (<a href="https://core.trac.wordpress.org/ticket/11226#comment:32" rel="nofollow">https://core.trac.wordpress.org/ticket/11226#comment:32</a>) which is filtered by <code>wp_ma... | [
{
"answer_id": 301367,
"author": "Cubakos",
"author_id": 107648,
"author_profile": "https://wordpress.stackexchange.com/users/107648",
"pm_score": 2,
"selected": false,
"text": "<p>Although, in my wp your <code>echo</code> displayed correctly (so maybe double check that you use the corre... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/240914",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/19543/"
] | Wordpress 4.4 indroduced a way to display the genitive case of a months name for specific locale by using the function `date_i18n` (<https://core.trac.wordpress.org/ticket/11226#comment:32>) which is filtered by `wp_maybe_decline_date()` (<https://core.trac.wordpress.org/browser/tags/4.6/src/wp-includes/functions.php#L... | Although, in my wp your `echo` displayed correctly (so maybe double check that you use the correct locale and that "decline months names: on or off" is translated as "on" in your locale), you can *"force"* genitive case, by making a generic wrap function based on the `wp_maybe_decline_date()`.
I have tested and used ... |
240,917 | <p>I am trying to add an custom action hook in wordpress but it's not working.Please help me through this.</p>
<pre><code><?php
function wp_add_google_link(){
global $WP_Admin_Bar;
var_dump($WP_Admin_Bar);
$WP_Admin_Bar->add_menu(array(
'id'=>'google_analytics',
'title'=>'GoogleAnalytics',
'hre... | [
{
"answer_id": 301367,
"author": "Cubakos",
"author_id": 107648,
"author_profile": "https://wordpress.stackexchange.com/users/107648",
"pm_score": 2,
"selected": false,
"text": "<p>Although, in my wp your <code>echo</code> displayed correctly (so maybe double check that you use the corre... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/240917",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103858/"
] | I am trying to add an custom action hook in wordpress but it's not working.Please help me through this.
```
<?php
function wp_add_google_link(){
global $WP_Admin_Bar;
var_dump($WP_Admin_Bar);
$WP_Admin_Bar->add_menu(array(
'id'=>'google_analytics',
'title'=>'GoogleAnalytics',
'href'=>'https://google.com/an... | Although, in my wp your `echo` displayed correctly (so maybe double check that you use the correct locale and that "decline months names: on or off" is translated as "on" in your locale), you can *"force"* genitive case, by making a generic wrap function based on the `wp_maybe_decline_date()`.
I have tested and used ... |
240,929 | <p>I have a plugin that adds the following action which among other things sends out a registration mail when a new user is added:</p>
<pre><code>add_action('um_post_registration_approved_hook', 'um_post_registration_approved_hook', 10, 2);
</code></pre>
<p>I would like to remove this action, so I can add it again wi... | [
{
"answer_id": 240930,
"author": "Andy Macaulay-Brook",
"author_id": 94267,
"author_profile": "https://wordpress.stackexchange.com/users/94267",
"pm_score": 4,
"selected": true,
"text": "<p>You want:</p>\n\n<pre><code>remove_action('um_post_registration_approved_hook', 'um_post_registrat... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/240929",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/54742/"
] | I have a plugin that adds the following action which among other things sends out a registration mail when a new user is added:
```
add_action('um_post_registration_approved_hook', 'um_post_registration_approved_hook', 10, 2);
```
I would like to remove this action, so I can add it again with some additional checks ... | You want:
```
remove_action('um_post_registration_approved_hook', 'um_post_registration_approved_hook', 10, 2);
```
... to run after the original `add_action`, but before the action triggers the function `um_post_registration_approved_hook`
The easiest way to do this, but I haven't tested it, might be to just give ... |
240,945 | <p>I have the code below for google fonts I retrieved google fonts detail as JSON data from google web fonts URL. Then i put all information into <code>$items = $data['items'];</code></p>
<p>Then I created the select box for <code>Goole font names</code> and then created another select box for <code>google font varian... | [
{
"answer_id": 240957,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 2,
"selected": true,
"text": "<p>This depends on what is it that you are trying to do/use. In theory the protocol used to communicate with ... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/240945",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/82436/"
] | I have the code below for google fonts I retrieved google fonts detail as JSON data from google web fonts URL. Then i put all information into `$items = $data['items'];`
Then I created the select box for `Goole font names` and then created another select box for `google font variants(font weights)` by using javascript... | This depends on what is it that you are trying to do/use. In theory the protocol used to communicate with memcached server is not very complex and can be implemented in PHP, and therefor as a plugin. In practice you might want to prevent collisions of multiple processes writing at the same time to the cahce which will ... |
240,970 | <p>I need to run a query (via <code>functions.php</code>) and find all posts with a certain tag and add those posts to a category.</p>
<p><strong>example:</strong> </p>
<p>Find all posts with tag <strong>"car"</strong> and add them to category <strong>"transportation"</strong>.</p>
<p><strong>EDIT:</strong> STILL NO... | [
{
"answer_id": 240973,
"author": "Benoti",
"author_id": 58141,
"author_profile": "https://wordpress.stackexchange.com/users/58141",
"pm_score": 1,
"selected": false,
"text": "<p>This is just an example to get all posts in the category transportation with the tag car :</p>\n\n<pre><code>$... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/240970",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18693/"
] | I need to run a query (via `functions.php`) and find all posts with a certain tag and add those posts to a category.
**example:**
Find all posts with tag **"car"** and add them to category **"transportation"**.
**EDIT:** STILL NOT WORKING, BUT...
This is what I have so far thanks to [@benoti's answer](https://word... | This is just an example to get all posts in the category transportation with the tag car :
```
$args = array(
'post_type'=>'post',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'transportation' ),
),
array(... |
240,974 | <p>I created an input field in general - settings. It's in a plugin for a for a local ngo network site. </p>
<p>It looks like this, and it works great.</p>
<pre><code>$ngob_sitelist_slug = new ngob_sitelist_slug();
class ngob_sitelist_slug {
function ngob_sitelist_slug( ) {
add_filter( 'admin_init' , arr... | [
{
"answer_id": 240976,
"author": "vancoder",
"author_id": 26778,
"author_profile": "https://wordpress.stackexchange.com/users/26778",
"pm_score": 2,
"selected": false,
"text": "<p>How are you invoking <code>ngob_sitelist_slug</code>?</p>\n\n<p>I'm gonna guess that you are doing something... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/240974",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/97904/"
] | I created an input field in general - settings. It's in a plugin for a for a local ngo network site.
It looks like this, and it works great.
```
$ngob_sitelist_slug = new ngob_sitelist_slug();
class ngob_sitelist_slug {
function ngob_sitelist_slug( ) {
add_filter( 'admin_init' , array( &$this , 'ngob_re... | How are you invoking `ngob_sitelist_slug`?
I'm gonna guess that you are doing something like `$my_class = new ngob_sitelist_slug;`. Doing it this way would require that your class have a [constructor](http://php.net/manual/en/language.oop5.decon.php). if it doesn't, you'll get an error.
You could still call your clas... |
240,983 | <p>I am creating a plugin for Wordpress, I have a script that runs perfectly to part to make ajax request to write some data in the database. The code works until the part to display the text within the `` div<code>passo2form</code> which is initially empty and after clicking on the text button is inserted into it. But... | [
{
"answer_id": 240986,
"author": "Benoti",
"author_id": 58141,
"author_profile": "https://wordpress.stackexchange.com/users/58141",
"pm_score": 0,
"selected": false,
"text": "<p>That not really the right to do it with WordPress (wp_localize_script, admin_url, wp_ajax_no_priv...).</p>\n\n... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/240983",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103909/"
] | I am creating a plugin for Wordpress, I have a script that runs perfectly to part to make ajax request to write some data in the database. The code works until the part to display the text within the `` div`passo2form` which is initially empty and after clicking on the text button is inserted into it. But the data are ... | Try like this
Main HTML:
```
<form class="home_footer" method="post" id="home_conct_form" action="">
<input type="text" name="fname" class="txt" />
<input type="text" name="lname" class="txt" />
<input type="button" name="home_submit" id="home_submit" value="Get In Touch"/>
</form>
```
Add on same pag... |
241,000 | <p>I'm using the Slick slider in my theme <a href="https://kenwheeler.github.io/slick/" rel="nofollow">https://kenwheeler.github.io/slick/</a> and Material design lite <a href="https://getmdl.io/" rel="nofollow">https://getmdl.io/</a></p>
<p>Problem I am having is that the transforms used here are conflicting with the... | [
{
"answer_id": 241005,
"author": "Andrew Welch",
"author_id": 17862,
"author_profile": "https://wordpress.stackexchange.com/users/17862",
"pm_score": 1,
"selected": false,
"text": "<p>Adding a css rule for #wpadminbar:</p>\n\n<pre><code>transform: translate3d(0,0,0);\nbackground: black;\... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/241000",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17862/"
] | I'm using the Slick slider in my theme <https://kenwheeler.github.io/slick/> and Material design lite <https://getmdl.io/>
Problem I am having is that the transforms used here are conflicting with the Wordpress admin bar and causing it to disappear. If I comment these out it works better, but still disappears if the s... | Adding a css rule for #wpadminbar:
```
transform: translate3d(0,0,0);
background: black;
width: 100%;
```
Makes the bar appear and
I added z-index: 0; to .mdl-layout\_\_header to make the dropdowns appear.
Not the prettiest. |
241,002 | <p>I've created a custom field 'entity_person_relevance' ranging from 1 to 3 in order to sort the results by relevance. The problem is that there are already more than 300 posts and the following query only shows posts with this custom field already set:</p>
<pre><code>$query = ( array (
'post_type' =>... | [
{
"answer_id": 241005,
"author": "Andrew Welch",
"author_id": 17862,
"author_profile": "https://wordpress.stackexchange.com/users/17862",
"pm_score": 1,
"selected": false,
"text": "<p>Adding a css rule for #wpadminbar:</p>\n\n<pre><code>transform: translate3d(0,0,0);\nbackground: black;\... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/241002",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/90416/"
] | I've created a custom field 'entity\_person\_relevance' ranging from 1 to 3 in order to sort the results by relevance. The problem is that there are already more than 300 posts and the following query only shows posts with this custom field already set:
```
$query = ( array (
'post_type' => 'entity',
... | Adding a css rule for #wpadminbar:
```
transform: translate3d(0,0,0);
background: black;
width: 100%;
```
Makes the bar appear and
I added z-index: 0; to .mdl-layout\_\_header to make the dropdowns appear.
Not the prettiest. |
241,017 | <p>How would i add is-active class to the first <code><li></code> generated by the query ? thank you I appreciate it.</p>
<pre><code><?php
$_terms = get_terms( array('claim-accordion-type') );
foreach ($_terms as $term) :
$term_slug = $term->slug;
$_posts = new WP_Query( array(... | [
{
"answer_id": 241026,
"author": "Ahmed Fouad",
"author_id": 102371,
"author_profile": "https://wordpress.stackexchange.com/users/102371",
"pm_score": 3,
"selected": true,
"text": "<pre><code><?php\n $_terms = get_terms( array('claim-accordion-type') );\n $i = 0;\n foreach ($... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/241017",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67512/"
] | How would i add is-active class to the first `<li>` generated by the query ? thank you I appreciate it.
```
<?php
$_terms = get_terms( array('claim-accordion-type') );
foreach ($_terms as $term) :
$term_slug = $term->slug;
$_posts = new WP_Query( array(
'post_type' ... | ```
<?php
$_terms = get_terms( array('claim-accordion-type') );
$i = 0;
foreach ($_terms as $term) :
$term_slug = $term->slug;
$_posts = new WP_Query( array( 'post_type' => 'claims_accordion', 'posts_per_page' => -1, 'ta... |
241,020 | <p>I am creating a plugin in WordPress that will send some data via email. When I activate the plugin, I'm getting a white screen.</p>
<p>I set <code>define('WP_DEBUG', true);</code> in <code>wp-config.php</code> but no error messages are displayed.</p>
<p>Here is the code for my plugin:</p>
<pre><code><?php
/* ... | [
{
"answer_id": 241022,
"author": "Dave Romsey",
"author_id": 2807,
"author_profile": "https://wordpress.stackexchange.com/users/2807",
"pm_score": 2,
"selected": false,
"text": "<p>Make sure to <a href=\"http://php.net/manual/en/function.error-reporting.php\" rel=\"nofollow\">configure P... | 2016/09/29 | [
"https://wordpress.stackexchange.com/questions/241020",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103909/"
] | I am creating a plugin in WordPress that will send some data via email. When I activate the plugin, I'm getting a white screen.
I set `define('WP_DEBUG', true);` in `wp-config.php` but no error messages are displayed.
Here is the code for my plugin:
```
<?php
/*
Plugin Name: Formulario Cotação
Plugin URI: http://so... | you should remove:
```
require('http://solutionsagencia.com.br/comparasaude/wp-load.php');
```
and use:
```
require(ABSPATH.'wp-includes/pluggable.php');
```
p.s. I advice you, these executions should be hooked in 'init', like:
```
add_action('init', function(){
$para = "email@email.com";
$assunto = "As... |
241,035 | <p>I've created some additional tables for a plugin I'm developing and need to add indexes to these tables. </p>
<p>What's the WordPress way to do this? </p>
<p>Using <a href="https://developer.wordpress.org/reference/functions/dbdelta/" rel="noreferrer"><code>dbDelta()</code></a> doesn't seem to be working, and I'm ... | [
{
"answer_id": 259270,
"author": "Paul 'Sparrow Hawk' Biron",
"author_id": 113496,
"author_profile": "https://wordpress.stackexchange.com/users/113496",
"pm_score": 4,
"selected": true,
"text": "<p>You can execute <em>arbitrary</em> SQL statements with <a href=\"https://developer.wordpre... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241035",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103259/"
] | I've created some additional tables for a plugin I'm developing and need to add indexes to these tables.
What's the WordPress way to do this?
Using [`dbDelta()`](https://developer.wordpress.org/reference/functions/dbdelta/) doesn't seem to be working, and I'm not seeing any error in the logs. | You can execute *arbitrary* SQL statements with [wpdb::query()](https://developer.wordpress.org/reference/classes/wpdb/query/), including Data Definition Statements, e.g.
```
function
create_index ()
{
global $wpdb ;
$sql = "CREATE INDEX my_index ON {$wpdb->prefix}my_table (my_column)" ;
$wpdb->query ($s... |
241,056 | <pre><code>add_action( 'init', 'create_topics_nonhierarchical_taxonomy', 0 );
function create_topics_nonhierarchical_taxonomy() {
// Labels part for the GUI
$labels = array(
'name' => _x( 'Blog Tags', 'taxonomy general name' ),
'singular_name' => _x( 'Blog Tag', 'taxonomy singular nam... | [
{
"answer_id": 259270,
"author": "Paul 'Sparrow Hawk' Biron",
"author_id": 113496,
"author_profile": "https://wordpress.stackexchange.com/users/113496",
"pm_score": 4,
"selected": true,
"text": "<p>You can execute <em>arbitrary</em> SQL statements with <a href=\"https://developer.wordpre... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241056",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103945/"
] | ```
add_action( 'init', 'create_topics_nonhierarchical_taxonomy', 0 );
function create_topics_nonhierarchical_taxonomy() {
// Labels part for the GUI
$labels = array(
'name' => _x( 'Blog Tags', 'taxonomy general name' ),
'singular_name' => _x( 'Blog Tag', 'taxonomy singular name' ),
... | You can execute *arbitrary* SQL statements with [wpdb::query()](https://developer.wordpress.org/reference/classes/wpdb/query/), including Data Definition Statements, e.g.
```
function
create_index ()
{
global $wpdb ;
$sql = "CREATE INDEX my_index ON {$wpdb->prefix}my_table (my_column)" ;
$wpdb->query ($s... |
241,060 | <p>I have the following problem:</p>
<p>I have created a custom post type <code>matratze</code> and currently besides the custom posts no other posts exist. Hence, nothing is being displayed under the recent posts. </p>
<p>The custom post type looks like the following:</p>
<p>[custom post]</p>
<p>My recent posts do... | [
{
"answer_id": 241076,
"author": "C Sabhar",
"author_id": 103830,
"author_profile": "https://wordpress.stackexchange.com/users/103830",
"pm_score": 2,
"selected": false,
"text": "<p>Wordpress provides <a href=\"https://developer.wordpress.org/reference/functions/wp_get_recent_posts/\" re... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241060",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/48703/"
] | I have the following problem:
I have created a custom post type `matratze` and currently besides the custom posts no other posts exist. Hence, nothing is being displayed under the recent posts.
The custom post type looks like the following:
[custom post]
My recent posts do not get displayed:
[main homepage]
I tr... | Wordpress provides [`wp_get_recent_posts()`](https://developer.wordpress.org/reference/functions/wp_get_recent_posts/) function to retrive a number of recent posts from any post types. you can pass your custom post type as an arguments to retrieve recent posts lists.
```
$args = array(
'numberposts' => '5',
'o... |
241,069 | <p>Im trying to show a box on left sidebar with links of current page's sub menus. but order is not applying same as menu! whats the problem?</p>
<pre><code><div class="sidebar-box">
<div class="sidebar-box-title">
<h4><?php echo get_the_title($post->post_par... | [
{
"answer_id": 241081,
"author": "TheDeadMedic",
"author_id": 1685,
"author_profile": "https://wordpress.stackexchange.com/users/1685",
"pm_score": 1,
"selected": false,
"text": "<p>Because you are ordering <em>only</em> by <code>menu_order</code>, rather than <code>menu_order post_title... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241069",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8124/"
] | Im trying to show a box on left sidebar with links of current page's sub menus. but order is not applying same as menu! whats the problem?
```
<div class="sidebar-box">
<div class="sidebar-box-title">
<h4><?php echo get_the_title($post->post_parent); ?></h4>
</div>
... | Because you are ordering *only* by `menu_order`, rather than `menu_order post_title`. In fact, you can just get rid of your `sort_*` arguments as `wp_list_pages` will output the correct natural order by default. |
241,094 | <p>I want to create a child theme for TwentyFifteen theme, which will customize a lot of things, including translation. When I install WordPress in my language (Farsi), it includes TwentyFifteen language files in <code>wp-content/languages/themes</code></p>
<p>So when I create a <code>languages</code> folder in my chi... | [
{
"answer_id": 241116,
"author": "cjbj",
"author_id": 75495,
"author_profile": "https://wordpress.stackexchange.com/users/75495",
"pm_score": 1,
"selected": false,
"text": "<p>Here's a quote from the <a href=\"https://core.trac.wordpress.org/browser/tags/4.6/src/wp-includes/l10n.php#L502... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241094",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103967/"
] | I want to create a child theme for TwentyFifteen theme, which will customize a lot of things, including translation. When I install WordPress in my language (Farsi), it includes TwentyFifteen language files in `wp-content/languages/themes`
So when I create a `languages` folder in my child theme and add customized lang... | Since WP 4.6 `load_theme_textdomain()` (and consequently `load_child_theme_textdomain()`) will give priority to .mo files downloaded from WP's online translation platform (translate.wordpress.org). Due to some new code ([here, on line 769](https://core.trac.wordpress.org/browser/tags/4.6/src/wp-includes/l10n.php#L755))... |
241,096 | <p>Is it possible to customize AJAX response when using filters such as <code>check_admin_referer</code> and <code>check_ajax_referer</code> ?</p>
<p>I've done some tweaks (with those filters) to prevent users from deleting some terms that are really important and MUST not be deleted. But it keeps telling me "unknown ... | [
{
"answer_id": 242359,
"author": "stims",
"author_id": 104727,
"author_profile": "https://wordpress.stackexchange.com/users/104727",
"pm_score": 0,
"selected": false,
"text": "<p>This is my first answer, hope it helps.</p>\n\n<p>If I understand your question correctly, you are wondering ... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241096",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31376/"
] | Is it possible to customize AJAX response when using filters such as `check_admin_referer` and `check_ajax_referer` ?
I've done some tweaks (with those filters) to prevent users from deleting some terms that are really important and MUST not be deleted. But it keeps telling me "unknown error" which is far from being c... | Wait for WordPress 4.7 on 6th December. It has this almost built-in.
If I got it right, then you'll want to prevent some terms from deletion.
I already made a snippet for that which works with WP 4.7
```
add_filter(
'user_has_cap',
function ( $allcaps, $caps, $args ) {
if ( ! isset( $args[0] ) || 'delete_term... |
241,119 | <p>I currently have a parent page with some child pages. I am able to list these child pages but would like to insert a custom li class. The <code>wp_list_pages</code> outputs <code><li class="page-item number"></li></code>. I would like for it to output <code><li class="hvr-underline"></li></co... | [
{
"answer_id": 242359,
"author": "stims",
"author_id": 104727,
"author_profile": "https://wordpress.stackexchange.com/users/104727",
"pm_score": 0,
"selected": false,
"text": "<p>This is my first answer, hope it helps.</p>\n\n<p>If I understand your question correctly, you are wondering ... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241119",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67512/"
] | I currently have a parent page with some child pages. I am able to list these child pages but would like to insert a custom li class. The `wp_list_pages` outputs `<li class="page-item number"></li>`. I would like for it to output `<li class="hvr-underline"></li>`. Here is the code I have so far:
```
$children = wp_lis... | Wait for WordPress 4.7 on 6th December. It has this almost built-in.
If I got it right, then you'll want to prevent some terms from deletion.
I already made a snippet for that which works with WP 4.7
```
add_filter(
'user_has_cap',
function ( $allcaps, $caps, $args ) {
if ( ! isset( $args[0] ) || 'delete_term... |
241,137 | <p>Recently I realized that you could include a db-error.php file in your <code>wp-content</code> directory from "<a href="https://wordpress.stackexchange.com/questions/239310/how-to-monitor-server-for-error-establishing-a-database-connection">How to monitor server for error establishing a database connection</a>" that... | [
{
"answer_id": 241140,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 3,
"selected": true,
"text": "<p>One option is setting the site's URL in the <code>wp-config.php</code> file itself. This effectively overrides the <c... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241137",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25271/"
] | Recently I realized that you could include a db-error.php file in your `wp-content` directory from "[How to monitor server for error establishing a database connection](https://wordpress.stackexchange.com/questions/239310/how-to-monitor-server-for-error-establishing-a-database-connection)" that would replace the existi... | One option is setting the site's URL in the `wp-config.php` file itself. This effectively overrides the `siteurl` option that's otherwise stored in the database, but it also means you can reference the URL without doing a query.
From [the Codex](https://codex.wordpress.org/Changing_The_Site_URL#Edit_wp-config.php):
>... |
241,152 | <p>Have a SQL dataset like this:</p>
<pre><code> Title Author Device1 Device2 Device3
Title1 j cool inputA inputA inputB
Title2 l maker inputA inputB inputC
Title3 m smith inputB inputB inputB
</code></pre>
<p>Want to display like this:</p>
<pre><code> Title Author header1 header2 h... | [
{
"answer_id": 241162,
"author": "motorbaby",
"author_id": 103935,
"author_profile": "https://wordpress.stackexchange.com/users/103935",
"pm_score": 0,
"selected": false,
"text": "<p>Got it working by installing the WP DB Driver plugin and skipping <code>wpdb</code> altogether. However, ... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241152",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103935/"
] | Have a SQL dataset like this:
```
Title Author Device1 Device2 Device3
Title1 j cool inputA inputA inputB
Title2 l maker inputA inputB inputC
Title3 m smith inputB inputB inputB
```
Want to display like this:
```
Title Author header1 header2 header3
Title1 j cool inputA: in... | I see no reason to use wpdb for this, unless your table is in the Wordpress database. Also your code would be much clearer (and therefore less prone to errors) if you separate the fetching of the result into an array, and the processing of this array for transformation, from the generation of the final html output. Sep... |
241,161 | <p>I am using WordPress 4.6.1. What tactics can I apply to find all available shortcodes that come with WordPress OOTB. I am having trouble find this information on the web. various guides in the codex and outside of it use simple examples like [gallery], but I am curious to knowing what is my full available list.</... | [
{
"answer_id": 241162,
"author": "motorbaby",
"author_id": 103935,
"author_profile": "https://wordpress.stackexchange.com/users/103935",
"pm_score": 0,
"selected": false,
"text": "<p>Got it working by installing the WP DB Driver plugin and skipping <code>wpdb</code> altogether. However, ... | 2016/09/30 | [
"https://wordpress.stackexchange.com/questions/241161",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98671/"
] | I am using WordPress 4.6.1. What tactics can I apply to find all available shortcodes that come with WordPress OOTB. I am having trouble find this information on the web. various guides in the codex and outside of it use simple examples like [gallery], but I am curious to knowing what is my full available list.
Thanks | I see no reason to use wpdb for this, unless your table is in the Wordpress database. Also your code would be much clearer (and therefore less prone to errors) if you separate the fetching of the result into an array, and the processing of this array for transformation, from the generation of the final html output. Sep... |
241,184 | <p>I am currently looking into passing a single query into multiple widgets on a template without running multiple queries. The obvious goal is speed and efficiency.</p>
<p>I have a widget that will deliver specific aspects of the same object with different instances of the widget in the template. Widget instances are... | [
{
"answer_id": 241188,
"author": "cybmeta",
"author_id": 37428,
"author_profile": "https://wordpress.stackexchange.com/users/37428",
"pm_score": 3,
"selected": true,
"text": "<p>I suggest to use the <a href=\"https://codex.wordpress.org/Class_Reference/WP_Object_Cache\" rel=\"nofollow\">... | 2016/10/01 | [
"https://wordpress.stackexchange.com/questions/241184",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27196/"
] | I am currently looking into passing a single query into multiple widgets on a template without running multiple queries. The obvious goal is speed and efficiency.
I have a widget that will deliver specific aspects of the same object with different instances of the widget in the template. Widget instances are a **must*... | I suggest to use the [Object Cache API](https://codex.wordpress.org/Class_Reference/WP_Object_Cache) or [Transients API](https://codex.wordpress.org/Transients_API), whatever fits better your needs.
A very quick example with object cache:
```
// helper function
function get_my_object() {
$object = wp_cache_get( '... |
241,267 | <p>I’m having a complex content issue. Each page can have multiple sections (unknown number), each section can have multiple containers, each container can have multiple content blocks (either 1, 2 or 3).</p>
<p>I’ve currently got a theoretical solution with shortcodes, but I would like to solve this with the UI if po... | [
{
"answer_id": 241281,
"author": "Andy Macaulay-Brook",
"author_id": 94267,
"author_profile": "https://wordpress.stackexchange.com/users/94267",
"pm_score": 1,
"selected": false,
"text": "<p>It's easier to code the Visual Editor so your content editors can highlight parts of the post con... | 2016/10/02 | [
"https://wordpress.stackexchange.com/questions/241267",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104083/"
] | I’m having a complex content issue. Each page can have multiple sections (unknown number), each section can have multiple containers, each container can have multiple content blocks (either 1, 2 or 3).
I’ve currently got a theoretical solution with shortcodes, but I would like to solve this with the UI if possible by ... | This sounds to me like a perfect use of [Advanced Custom Fields "flexible content"](https://www.advancedcustomfields.com/resources/flexible-content/) feature to me. Flexible content fields allow you to define multiple layouts, and then add them to a page or post one by one, in any order or combination you need. Each la... |
241,269 | <p>I have a plugin which requires a style sheet for the widget. I am trying to register the stylesheet when the widget is created, however the style sheet is not being queued and the styles ignored. The code I am using follows, with commented lines demonstrating some other options I have tried:</p>
<p>organiser.php</p... | [
{
"answer_id": 241281,
"author": "Andy Macaulay-Brook",
"author_id": 94267,
"author_profile": "https://wordpress.stackexchange.com/users/94267",
"pm_score": 1,
"selected": false,
"text": "<p>It's easier to code the Visual Editor so your content editors can highlight parts of the post con... | 2016/10/02 | [
"https://wordpress.stackexchange.com/questions/241269",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104085/"
] | I have a plugin which requires a style sheet for the widget. I am trying to register the stylesheet when the widget is created, however the style sheet is not being queued and the styles ignored. The code I am using follows, with commented lines demonstrating some other options I have tried:
organiser.php
```
class O... | This sounds to me like a perfect use of [Advanced Custom Fields "flexible content"](https://www.advancedcustomfields.com/resources/flexible-content/) feature to me. Flexible content fields allow you to define multiple layouts, and then add them to a page or post one by one, in any order or combination you need. Each la... |
241,271 | <p>I'm using <a href="https://wordpress.org/plugins/json-rest-api/" rel="noreferrer">wp-rest api</a> to get posts information.
I also use <a href="https://github.com/bueltge/wp-rest-api-filter-items" rel="noreferrer">wp rest api filter items</a> to filter fields and summarize the result:</p>
<p>When I call <code>http:... | [
{
"answer_id": 241422,
"author": "Jesús Franco",
"author_id": 16301,
"author_profile": "https://wordpress.stackexchange.com/users/16301",
"pm_score": 4,
"selected": false,
"text": "<p>Just add the <code>_embed</code> query argument to your URL asking for the posts, and every post object,... | 2016/10/02 | [
"https://wordpress.stackexchange.com/questions/241271",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/86163/"
] | I'm using [wp-rest api](https://wordpress.org/plugins/json-rest-api/) to get posts information.
I also use [wp rest api filter items](https://github.com/bueltge/wp-rest-api-filter-items) to filter fields and summarize the result:
When I call `http://example.com/wp-json/wp/v2/posts?items=id,title,featured_media` it ret... | Ah I just had this problem myself! And while `_embed` is great, in my experience it is very slow, and the point of JSON is to be fast :D
I have the following code in a plugin (used for adding custom post types), but I imagine you could put it in your theme's `function.php` file.
`php`
```
add_action( 'rest_api_init'... |
241,287 | <p>To get with the time and improve my coding practices, I'm starting to implementing <a href="https://secure.php.net/manual/en/language.namespaces.php" rel="nofollow">namespaces</a> in my own plugins moving forward since there are some advantages, <a href="https://stackoverflow.com/q/5393108/6579923">such as eliminati... | [
{
"answer_id": 241294,
"author": "C Sabhar",
"author_id": 103830,
"author_profile": "https://wordpress.stackexchange.com/users/103830",
"pm_score": 3,
"selected": true,
"text": "<p>The problem is with your Autoloader set-up. You need to convert your Camelcase namespacese to dashes for lo... | 2016/10/02 | [
"https://wordpress.stackexchange.com/questions/241287",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98212/"
] | To get with the time and improve my coding practices, I'm starting to implementing [namespaces](https://secure.php.net/manual/en/language.namespaces.php) in my own plugins moving forward since there are some advantages, [such as eliminating ambiguity](https://stackoverflow.com/q/5393108/6579923).
I found a [similar qu... | The problem is with your Autoloader set-up. You need to convert your Camelcase namespacese to dashes for locating files as per your current folder structure.
I have added convert function and updated your autoloader function.
In `wp-plugin-template/autoloader.php`:
```
<?php
spl_autoload_register( 'autoload_function... |
241,303 | <p>Our WordPress website has a static html home page. A request for the domain returns the <code>index.html</code> page.</p>
<p>This has served our purposes well, but has caused a problem when trying to preview a post or page during editing. Since the preview URLs do not include <code>index.php</code> all preview requ... | [
{
"answer_id": 241304,
"author": "Ethan O'Sullivan",
"author_id": 98212,
"author_profile": "https://wordpress.stackexchange.com/users/98212",
"pm_score": 0,
"selected": false,
"text": "<p>You can add the following rewrite rule in your <code>.htaccess</code>:</p>\n\n<pre><code><IfModul... | 2016/10/02 | [
"https://wordpress.stackexchange.com/questions/241303",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104100/"
] | Our WordPress website has a static html home page. A request for the domain returns the `index.html` page.
This has served our purposes well, but has caused a problem when trying to preview a post or page during editing. Since the preview URLs do not include `index.php` all preview requests display the static home pag... | Don't change your rewrites. Put the content of the HTML file into a front-page.php template file in your theme. |
241,326 | <p>I have a simple plugin which adds a signature at the end of each post. But it also appears after user comment section. How to avoid the latter?</p>
<p><strong>Update</strong></p>
<p>I have tried to run the function once by adding a static variable. Now signature is just adding to comment section. I need exactly th... | [
{
"answer_id": 241304,
"author": "Ethan O'Sullivan",
"author_id": 98212,
"author_profile": "https://wordpress.stackexchange.com/users/98212",
"pm_score": 0,
"selected": false,
"text": "<p>You can add the following rewrite rule in your <code>.htaccess</code>:</p>\n\n<pre><code><IfModul... | 2016/10/03 | [
"https://wordpress.stackexchange.com/questions/241326",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32602/"
] | I have a simple plugin which adds a signature at the end of each post. But it also appears after user comment section. How to avoid the latter?
**Update**
I have tried to run the function once by adding a static variable. Now signature is just adding to comment section. I need exactly the reverse. Hope this helps.
`... | Don't change your rewrites. Put the content of the HTML file into a front-page.php template file in your theme. |
241,353 | <p>I want to add a new image size option to the contents image editor. The code below is what I currently have but for some reason I am not seeing the option (as shown in the image below) in the editor. I am using WordPress Version 4.6.1. What could be the problem? Thanks in advance.</p>
<p><a href="https://i.stack.im... | [
{
"answer_id": 241358,
"author": "cybmeta",
"author_id": 37428,
"author_profile": "https://wordpress.stackexchange.com/users/37428",
"pm_score": 2,
"selected": false,
"text": "<p>You need to register the image size first using <a href=\"http://www.wpbeginner.com/wp-tutorials/how-to-creat... | 2016/10/03 | [
"https://wordpress.stackexchange.com/questions/241353",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/99178/"
] | I want to add a new image size option to the contents image editor. The code below is what I currently have but for some reason I am not seeing the option (as shown in the image below) in the editor. I am using WordPress Version 4.6.1. What could be the problem? Thanks in advance.
[`](http://www.wpbeginner.com/wp-tutorials/how-to-create-additional-image-sizes-in-wordpress/), for example:
```
add_action( 'after_setup_theme', 'cyb_add_image_sizes' );
function cyb_add_image_sizes() {
add_image_size( 'my-image-size-name', 120, 120... |
241,361 | <p>I have a template with 4 css files: <code>rtl.css</code>, <code>style.css</code>, <code>main.css</code>, <code>bootstrap.css</code>.</p>
<p><code>rtl.css</code> and <code>style.css</code> are located in my template root, for example:
<code>my_template_root/style.css</code>.</p>
<p><code>main.css</code> and <code>... | [
{
"answer_id": 241363,
"author": "cjbj",
"author_id": 75495,
"author_profile": "https://wordpress.stackexchange.com/users/75495",
"pm_score": -1,
"selected": false,
"text": "<p>Assuming that your css files are correctly uploaded to your server, the most likely cause for the changes not s... | 2016/10/03 | [
"https://wordpress.stackexchange.com/questions/241361",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104076/"
] | I have a template with 4 css files: `rtl.css`, `style.css`, `main.css`, `bootstrap.css`.
`rtl.css` and `style.css` are located in my template root, for example:
`my_template_root/style.css`.
`main.css` and `bootstrap.css` are located, for example:
`my_template_root/assets/stylesheet/main.css`
`functions.php` code ... | You are calling your css files with wrong function like in following line of your code
```
wp_enqueue_style( 'parent-style', get_directory_directory_uri() . 'style.css' );
```
You are using `get_directory_directory_uri()` function to call files which is not event a function in wordpress.
Files must be called with o... |
241,376 | <p>I am using the following code in a page template</p>
<pre><code><?php
$args=array(
'post_parent' => 27641,
'post_type' => 'page',
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(... | [
{
"answer_id": 241363,
"author": "cjbj",
"author_id": 75495,
"author_profile": "https://wordpress.stackexchange.com/users/75495",
"pm_score": -1,
"selected": false,
"text": "<p>Assuming that your css files are correctly uploaded to your server, the most likely cause for the changes not s... | 2016/10/03 | [
"https://wordpress.stackexchange.com/questions/241376",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/94003/"
] | I am using the following code in a page template
```
<?php
$args=array(
'post_parent' => 27641,
'post_type' => 'page',
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
```
to get a list of dir... | You are calling your css files with wrong function like in following line of your code
```
wp_enqueue_style( 'parent-style', get_directory_directory_uri() . 'style.css' );
```
You are using `get_directory_directory_uri()` function to call files which is not event a function in wordpress.
Files must be called with o... |
241,386 | <p>I made custom post type with one taxonomy. Everything was good except pagination on taxonomy. Firstly, without any changes, I was able to switch pages on main custom post type archive:</p>
<pre><code>website.com/custom_post_type_name/page/x
</code></pre>
<p>But when I wanted to jump to taxonomy and switch pages I ... | [
{
"answer_id": 241646,
"author": "Zaid Sameer",
"author_id": 28376,
"author_profile": "https://wordpress.stackexchange.com/users/28376",
"pm_score": 1,
"selected": false,
"text": "<p>From the Admin Dashboard, Go to <strong>Permalink Settings</strong> and hit <strong>Save Changes</strong>... | 2016/10/03 | [
"https://wordpress.stackexchange.com/questions/241386",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104146/"
] | I made custom post type with one taxonomy. Everything was good except pagination on taxonomy. Firstly, without any changes, I was able to switch pages on main custom post type archive:
```
website.com/custom_post_type_name/page/x
```
But when I wanted to jump to taxonomy and switch pages I got 404 error.
```
websit... | I solved it!
You need to var\_dump wp\_query on 1st page and on 404 page
```
add_action( 'pre_get_posts', 'elo_jlb' );
function elo_jlb($query)
{
if(!is_admin())
{
$query->set('paged', $query->get('page'));
$query->set('HERE_POST_TYPE_NAME', '');
}
}
``` |
241,398 | <p>When using this code below with <code>wp_mail()</code> I always get in the header
wordpress@mydomainname.nl. And in Thunderbird in column Correspondents: Wordpress.
But I need: 'From: "Klantenservice"<' . $emailTo . '>'</p>
<p>In <a href="https://developer.wordpress.org/reference/functions/wp_mail/" rel="nofollo... | [
{
"answer_id": 241434,
"author": "Jeff Mattson",
"author_id": 93714,
"author_profile": "https://wordpress.stackexchange.com/users/93714",
"pm_score": 3,
"selected": true,
"text": "<p>It looks like you are setting the <code>$emailto</code> variable after the place you are using it.</p>\n"... | 2016/10/03 | [
"https://wordpress.stackexchange.com/questions/241398",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/78746/"
] | When using this code below with `wp_mail()` I always get in the header
wordpress@mydomainname.nl. And in Thunderbird in column Correspondents: Wordpress.
But I need: 'From: "Klantenservice"<' . $emailTo . '>'
In <https://developer.wordpress.org/reference/functions/wp_mail/> and other pages I can not find a solution fo... | It looks like you are setting the `$emailto` variable after the place you are using it. |
241,424 | <p>Is there a way to add an "incorrect password" error message on password protected pages?</p>
<p>I've looked everywhere and the closest thing I can find is from here: <a href="https://wordpress.stackexchange.com/questions/71284/add-error-message-on-password-protected-page">Add error message on password protected pag... | [
{
"answer_id": 241426,
"author": "Nuno Sarmento",
"author_id": 75461,
"author_profile": "https://wordpress.stackexchange.com/users/75461",
"pm_score": -1,
"selected": false,
"text": "<p>I have not tested the code but it seems this is what you are looking for - add the snippet on your fun... | 2016/10/03 | [
"https://wordpress.stackexchange.com/questions/241424",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/41083/"
] | Is there a way to add an "incorrect password" error message on password protected pages?
I've looked everywhere and the closest thing I can find is from here: [Add error message on password protected page](https://wordpress.stackexchange.com/questions/71284/add-error-message-on-password-protected-page)
The problem is... | Here's a combination of these two great answers ([21697](https://wordpress.stackexchange.com/questions/21697/password-protected-post-or-page-error-message-by-wrong-password) & [71284](https://wordpress.stackexchange.com/questions/71284/add-error-message-on-password-protected-page)) to similar questions.
`wpse241424_ch... |
241,453 | <p>I am planning to make a website where non website members should see a different view of the footer.</p>
<p>Is this possible using css only?</p>
| [
{
"answer_id": 241455,
"author": "cjbj",
"author_id": 75495,
"author_profile": "https://wordpress.stackexchange.com/users/75495",
"pm_score": 0,
"selected": false,
"text": "<p>If your theme is decently made, there will be a <a href=\"https://developer.wordpress.org/reference/functions/bo... | 2016/10/04 | [
"https://wordpress.stackexchange.com/questions/241453",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101629/"
] | I am planning to make a website where non website members should see a different view of the footer.
Is this possible using css only? | When a user is logged in, WordPress adds the class logged-in to the body tag, so you can target CSS differently for logged in users.
```
body > footer {
background: black;
}
body.logged-in > footer {
background: red;
}
```
for example.
This is only good for cosmetic changes though. Don't try to use it to... |
241,476 | <p>I have this function hardcoded into content-single-product.php (WooCommerce) and it works to show 3 random products from <strong>categories ID 64 and 72</strong>:</p>
<pre><code>$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => '3',
'orderby' ... | [
{
"answer_id": 241481,
"author": "ClemC",
"author_id": 73239,
"author_profile": "https://wordpress.stackexchange.com/users/73239",
"pm_score": 4,
"selected": true,
"text": "<p>I suspect the problem is coming from <code>$MyCustomField</code> which you enter as such in: </p>\n\n<pre><code... | 2016/10/04 | [
"https://wordpress.stackexchange.com/questions/241476",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101024/"
] | I have this function hardcoded into content-single-product.php (WooCommerce) and it works to show 3 random products from **categories ID 64 and 72**:
```
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => '3',
'orderby' => 'rand',
'tax_query' ... | I suspect the problem is coming from `$MyCustomField` which you enter as such in:
```
'terms' => array( $MyCustomField ),
```
The query consider it as only one value: `'64,72'`, a string.
So try:
```
$MyCustomFieldValues = array_map( 'intval', explode( ',', $MyCustomField ) );
```
This will also ensure your val... |
241,477 | <p>My custom made plugin has "a new version available", also the "view details" link links to a completely unrelated plugin.</p>
<p>The plugin files begins with:</p>
<pre><code><?php
/*
Plugin Name: Simple Contact Form
Plugin URI: http://www.wilcoverhoeven.com
Description: Simple contact form
Version: 1
Author: W... | [
{
"answer_id": 241478,
"author": "FaCE",
"author_id": 96768,
"author_profile": "https://wordpress.stackexchange.com/users/96768",
"pm_score": 5,
"selected": true,
"text": "<p>I think you've got a naming conflict there -- assuming that your plugin is linking to <a href=\"https://en-gb.wor... | 2016/10/04 | [
"https://wordpress.stackexchange.com/questions/241477",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103917/"
] | My custom made plugin has "a new version available", also the "view details" link links to a completely unrelated plugin.
The plugin files begins with:
```
<?php
/*
Plugin Name: Simple Contact Form
Plugin URI: http://www.wilcoverhoeven.com
Description: Simple contact form
Version: 1
Author: Wilco Verhoeven
Author UR... | I think you've got a naming conflict there -- assuming that your plugin is linking to [this](https://en-gb.wordpress.org/plugins/simple-contact-form/) Simple Contact Form -- try changing the name to something like "Wilco's Simple Contact Form".
You'll need to update the plugin folder name and the main plugin file nam... |
241,504 | <p>I'm trying to add a PureCSS class to the <code><form></code> tag in the default comments template, but the class isn't being added. Here's what I've done so far:</p>
<pre><code>function pwp_comments_form_pure($output) {
$output = preg_replace('/class="comment-form"/', 'class="comment-form pure-form"', $ou... | [
{
"answer_id": 241506,
"author": "TheDeadMedic",
"author_id": 1685,
"author_profile": "https://wordpress.stackexchange.com/users/1685",
"pm_score": 3,
"selected": true,
"text": "<p>Any <code>comments_template</code> filter should return <a href=\"https://codex.wordpress.org/Plugin_API/Fi... | 2016/10/04 | [
"https://wordpress.stackexchange.com/questions/241504",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/19608/"
] | I'm trying to add a PureCSS class to the `<form>` tag in the default comments template, but the class isn't being added. Here's what I've done so far:
```
function pwp_comments_form_pure($output) {
$output = preg_replace('/class="comment-form"/', 'class="comment-form pure-form"', $output);
return $output;
}
ad... | Any `comments_template` filter should return [an absolute filepath to the comments template](https://codex.wordpress.org/Plugin_API/Filter_Reference/comments_template) - use `comment_form_defaults` and set the `class_form` argument:
```
add_filter( 'comment_form_defaults', function ( $args ) {
$args['class_form'] ... |
241,530 | <p>I am working on a plugin that posts an XML request to a vendor's shipping API to get shipping quotes. The XML is stored in a string called $xml. I can post the XML request successfully with curl using these parameters:</p>
<pre><code>$curl = curl_init( $this->settings['api_url'] );
curl_setopt( $curl, CURLOPT_HE... | [
{
"answer_id": 241538,
"author": "T.Todua",
"author_id": 33667,
"author_profile": "https://wordpress.stackexchange.com/users/33667",
"pm_score": 0,
"selected": false,
"text": "<p>I think you should have <code>body</code> like this:</p>\n\n<pre><code>'body' => array( 'username' => '... | 2016/10/04 | [
"https://wordpress.stackexchange.com/questions/241530",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104148/"
] | I am working on a plugin that posts an XML request to a vendor's shipping API to get shipping quotes. The XML is stored in a string called $xml. I can post the XML request successfully with curl using these parameters:
```
$curl = curl_init( $this->settings['api_url'] );
curl_setopt( $curl, CURLOPT_HEADER, 0 );
curl_s... | I tried some more trial and error and managed to get it to work by simply putting $xml as the body without specifying it as an array. The function reference says, "Post data should be sent in the body as an array," so I'm not sure why it worked.
Here is the working code in case it helps someone else:
```
// Sends the... |
241,542 | <p>Learning PHP and a little stuck on a fairly straight forward issue.
I am trying to edit my WooCommerce invoice</p>
<p>This code <code><?php echo $sign.number_format($order->get_subtotal(),2); ?></code> Returns $50.98</p>
<p>This code <code>$first_number = $order->get_subtotal();</code> Returns a variab... | [
{
"answer_id": 241552,
"author": "Jason",
"author_id": 104148,
"author_profile": "https://wordpress.stackexchange.com/users/104148",
"pm_score": 2,
"selected": true,
"text": "<p>Try</p>\n\n<pre><code>$first_number = number_format( $order->get_subtotal(), 2 );\n</code></pre>\n\n<p>numb... | 2016/10/04 | [
"https://wordpress.stackexchange.com/questions/241542",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104225/"
] | Learning PHP and a little stuck on a fairly straight forward issue.
I am trying to edit my WooCommerce invoice
This code `<?php echo $sign.number_format($order->get_subtotal(),2); ?>` Returns $50.98
This code `$first_number = $order->get_subtotal();` Returns a variable of 51, it rounds up as the `,2` is missing.
How ... | Try
```
$first_number = number_format( $order->get_subtotal(), 2 );
```
number\_format() is the php function that is setting the decimals in your first bit of code above.
See <http://php.net/manual/en/function.number-format.php> |
241,543 | <p>I would like to know how to bulk delete posts from a specific category using the <a href="http://wp-cli.org/" rel="nofollow">WP-CLI</a>, any tip?</p>
| [
{
"answer_id": 241558,
"author": "ClemC",
"author_id": 73239,
"author_profile": "https://wordpress.stackexchange.com/users/73239",
"pm_score": 5,
"selected": true,
"text": "<p>This should delete <strong>all</strong> posts in your category:</p>\n\n<pre><code>wp post delete $(wp post list ... | 2016/10/04 | [
"https://wordpress.stackexchange.com/questions/241543",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104229/"
] | I would like to know how to bulk delete posts from a specific category using the [WP-CLI](http://wp-cli.org/), any tip? | This should delete **all** posts in your category:
```
wp post delete $(wp post list --cat=your_category_ID --format=ids)
```
**Or** directly:
```
wp db query [<your_sql_query>]
```
For more info:
```
wp post delete --help
wp post list --help
wp db query --help
``` |
241,570 | <p>I have created a Custom Post Type <code>Projects</code>. Below is my code. Everything is working fine, but when I click on a Category of this Post Type it redirects me to the Homepage. I have tried all possible methods, but I am still unable to find the issue.</p>
<pre><code> add_action( 'init', 'create_posttype'... | [
{
"answer_id": 241558,
"author": "ClemC",
"author_id": 73239,
"author_profile": "https://wordpress.stackexchange.com/users/73239",
"pm_score": 5,
"selected": true,
"text": "<p>This should delete <strong>all</strong> posts in your category:</p>\n\n<pre><code>wp post delete $(wp post list ... | 2016/10/05 | [
"https://wordpress.stackexchange.com/questions/241570",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104241/"
] | I have created a Custom Post Type `Projects`. Below is my code. Everything is working fine, but when I click on a Category of this Post Type it redirects me to the Homepage. I have tried all possible methods, but I am still unable to find the issue.
```
add_action( 'init', 'create_posttype' );
function create_p... | This should delete **all** posts in your category:
```
wp post delete $(wp post list --cat=your_category_ID --format=ids)
```
**Or** directly:
```
wp db query [<your_sql_query>]
```
For more info:
```
wp post delete --help
wp post list --help
wp db query --help
``` |
241,601 | <p>I want to query posts where meta value is empty. for example, I want to get these three posts, with no meta values:
<a href="https://i.stack.imgur.com/9U69t.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/9U69t.jpg" alt="enter image description here"></a></p>
<p>Already tried:</p>
<pre><code>$args = arra... | [
{
"answer_id": 241605,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 3,
"selected": true,
"text": "<p>I think you forgot about the <em>inherit</em> post status. The default one in <code>WP_Query</code> is <em>pub... | 2016/10/05 | [
"https://wordpress.stackexchange.com/questions/241601",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70845/"
] | I want to query posts where meta value is empty. for example, I want to get these three posts, with no meta values:
[](https://i.stack.imgur.com/9U69t.jpg)
Already tried:
```
$args = array(
'post_type' => 'attachment',
'posts_per_page' => 1... | I think you forgot about the *inherit* post status. The default one in `WP_Query` is *publish*.
You should also use `=` instead of `LIKE`, to avoid using `LIKE '%%'` in the SQL query.
So try to add this:
```
'post_status' => 'inherit'
```
and
```
'compare' => '='
```
into your query arguments, to match the empt... |
241,612 | <p>I am attaching an image to a post with the media import command.</p>
<p>I know I can get the image id using the --porcelain option, but how can I get the image url from this id?</p>
<p>Or is there a way to display the featured image's url of a post (apparently the list command does allow this)?</p>
| [
{
"answer_id": 241621,
"author": "Javier Villanueva",
"author_id": 3893,
"author_profile": "https://wordpress.stackexchange.com/users/3893",
"pm_score": 2,
"selected": false,
"text": "<p>Media attachments are tricky to get through the cli because they are stored as a serialised array in ... | 2016/10/05 | [
"https://wordpress.stackexchange.com/questions/241612",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44388/"
] | I am attaching an image to a post with the media import command.
I know I can get the image id using the --porcelain option, but how can I get the image url from this id?
Or is there a way to display the featured image's url of a post (apparently the list command does allow this)? | Assuming the attachment ID were in a variable of `$attachment_id` you could use the following command:
```
# get attachment URL
wp db query "SELECT guid FROM $(wp db tables *_posts) WHERE ID=\"$attachment_id\"" | head -n 2 | tail -1
```
I use the `$(wp db tables *_posts)` bit just in case the `wp_` table prefix is n... |
241,634 | <p>I tried to include shortcodes with a parameter in raw html output, like shown below:</p>
<pre><code><a href="https://example.com/folder/edit.php?action=someaction&id=[foocode parameter='value']&edittoken=[foocode parameter='othervalue']">linktext</a>
</code></pre>
<p>This crashes the PHP functi... | [
{
"answer_id": 241637,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 3,
"selected": false,
"text": "<p>shortcodes are not allowed in html attributes, shortcodes are not programing language, they are place hol... | 2016/10/05 | [
"https://wordpress.stackexchange.com/questions/241634",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104289/"
] | I tried to include shortcodes with a parameter in raw html output, like shown below:
```
<a href="https://example.com/folder/edit.php?action=someaction&id=[foocode parameter='value']&edittoken=[foocode parameter='othervalue']">linktext</a>
```
This crashes the PHP function `do_shortcode()`.
Is stuff like this reall... | shortcodes are not allowed in html attributes, shortcodes are not programing language, they are place holders to proper html content. |
241,677 | <p>I am developing a theme and am getting the following error "<code>Warning: trim() expects parameter 1 to be string, array given in C:\wamp\www\themes\wp-includes\query.php on line 1609</code>". I have tried everything I could think of and have Googled for longer than I'd like to admit trying to get it sorted out.</p... | [
{
"answer_id": 241649,
"author": "Jonny Perl",
"author_id": 40765,
"author_profile": "https://wordpress.stackexchange.com/users/40765",
"pm_score": 0,
"selected": false,
"text": "<p>It would appear that you can do this quite easily via <a href=\"https://en-gb.wordpress.org/plugins/wp-lat... | 2016/10/05 | [
"https://wordpress.stackexchange.com/questions/241677",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104314/"
] | I am developing a theme and am getting the following error "`Warning: trim() expects parameter 1 to be string, array given in C:\wamp\www\themes\wp-includes\query.php on line 1609`". I have tried everything I could think of and have Googled for longer than I'd like to admit trying to get it sorted out.
**The Issue**
... | The Wordpress-produced plugin Jetpack has LaTeX support. See this [link](https://jetpack.com/support/beautiful-math-with-latex/). However, in my development, it didn't seem to work, so I've been using a plugin called MathJax-LaTeX. Yesterday, I discovered a plugin called WP QuickLaTeX, but I haven't been able to test i... |
241,698 | <p>I have a custom post type called <code>laptop</code> with custom fields such as <code>CPU</code>, <code>OS</code>, <code>RAM</code> etc. creatied using the <code>Advanced Custom Fields</code> plugin.</p>
<p>I'm displaying a table of laptops, where the table header is a row of custom fields, and each following row i... | [
{
"answer_id": 242184,
"author": "prosti",
"author_id": 88606,
"author_profile": "https://wordpress.stackexchange.com/users/88606",
"pm_score": 0,
"selected": false,
"text": "<p>Simple with this reference:\n<a href=\"https://codex.wordpress.org/Class_Reference/WP_Query\" rel=\"nofollow n... | 2016/10/06 | [
"https://wordpress.stackexchange.com/questions/241698",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3206/"
] | I have a custom post type called `laptop` with custom fields such as `CPU`, `OS`, `RAM` etc. creatied using the `Advanced Custom Fields` plugin.
I'm displaying a table of laptops, where the table header is a row of custom fields, and each following row is a laptop name and it's custom field values in each of the corre... | To follow up on @rock3t's comment, do you really have to query the backend whenever a user clicks on a column header?
Have you looking into using the jQuery [tablesorter](https://plugins.jquery.com/tablesorter/)? It allows an end-user to sort an HTML table by doing DOM manipulations.
I've never used it in a WP projec... |
241,707 | <p>Is any way to don`t display shrort description in a single entry page?</p>
<p>It is necessary to be able to write any text, then paste the tag "more". This content should be displayed only on the list of records page. But it should not be displayed on the single entry page.</p>
| [
{
"answer_id": 242184,
"author": "prosti",
"author_id": 88606,
"author_profile": "https://wordpress.stackexchange.com/users/88606",
"pm_score": 0,
"selected": false,
"text": "<p>Simple with this reference:\n<a href=\"https://codex.wordpress.org/Class_Reference/WP_Query\" rel=\"nofollow n... | 2016/10/06 | [
"https://wordpress.stackexchange.com/questions/241707",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/83974/"
] | Is any way to don`t display shrort description in a single entry page?
It is necessary to be able to write any text, then paste the tag "more". This content should be displayed only on the list of records page. But it should not be displayed on the single entry page. | To follow up on @rock3t's comment, do you really have to query the backend whenever a user clicks on a column header?
Have you looking into using the jQuery [tablesorter](https://plugins.jquery.com/tablesorter/)? It allows an end-user to sort an HTML table by doing DOM manipulations.
I've never used it in a WP projec... |
241,711 | <p>I tried to change the caption "related posts" of <a href="https://wordpress.org/plugins/related-posts-thumbnails/" rel="nofollow">https://wordpress.org/plugins/related-posts-thumbnails/</a> to something else.</p>
<p>I tried to change the value of <code>$top_text</code> to <code><h3>THIS IS NEW CAPTION:</h3... | [
{
"answer_id": 242184,
"author": "prosti",
"author_id": 88606,
"author_profile": "https://wordpress.stackexchange.com/users/88606",
"pm_score": 0,
"selected": false,
"text": "<p>Simple with this reference:\n<a href=\"https://codex.wordpress.org/Class_Reference/WP_Query\" rel=\"nofollow n... | 2016/10/06 | [
"https://wordpress.stackexchange.com/questions/241711",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4078/"
] | I tried to change the caption "related posts" of <https://wordpress.org/plugins/related-posts-thumbnails/> to something else.
I tried to change the value of `$top_text` to `<h3>THIS IS NEW CAPTION:</h3>` but it does not work. Why ?
```
<?php
/**
* Plugin Name: Related Posts Thumbnails
* Plugin URI... | To follow up on @rock3t's comment, do you really have to query the backend whenever a user clicks on a column header?
Have you looking into using the jQuery [tablesorter](https://plugins.jquery.com/tablesorter/)? It allows an end-user to sort an HTML table by doing DOM manipulations.
I've never used it in a WP projec... |
241,741 | <p>For example, if I have a custom post type that are '<strong>Case Studies</strong>',</p>
<p>Firstly I need to be able to query the post types for a <strong>single</strong> specific case study, but then lets say there are a few <strong>variations</strong> of that single case study;</p>
<p>'Wales', 'England', 'Scotla... | [
{
"answer_id": 241744,
"author": "Benoti",
"author_id": 58141,
"author_profile": "https://wordpress.stackexchange.com/users/58141",
"pm_score": 1,
"selected": false,
"text": "<p>You have to create your own shortcodes to do this. Use <code>add_shortcode()</code>, create a fonction that ca... | 2016/10/06 | [
"https://wordpress.stackexchange.com/questions/241741",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98971/"
] | For example, if I have a custom post type that are '**Case Studies**',
Firstly I need to be able to query the post types for a **single** specific case study, but then lets say there are a few **variations** of that single case study;
'Wales', 'England', 'Scotland'... . The correct one needs to be picked out dependin... | From your supplied info, it's not all very clear to me. But as far as I've understood your problem, here's my approach.
Assuming we have the following shortcode that the user has put inside a **normal** post's content and that this shortcode will pull information from your custom post type `case_studies`:
```
[case... |
241,743 | <p>I want to include some HTML, spezific a bootstrap modal box.</p>
<p>This is my function with the HTML part:</p>
<pre><code>public function dmd_fav_modal_box() {
$content = '<div class="modal fade" id="dmd_favorite_modal" tabindex="-1" role="dialog" aria-labelledby="dmd_favorite_modalLabel">
<d... | [
{
"answer_id": 241745,
"author": "Benoti",
"author_id": 58141,
"author_profile": "https://wordpress.stackexchange.com/users/58141",
"pm_score": 2,
"selected": true,
"text": "<p>You only need the_content filter to add the modal, but bootstrap.js is needed to make it work.</p>\n\n<pre><cod... | 2016/10/06 | [
"https://wordpress.stackexchange.com/questions/241743",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/78481/"
] | I want to include some HTML, spezific a bootstrap modal box.
This is my function with the HTML part:
```
public function dmd_fav_modal_box() {
$content = '<div class="modal fade" id="dmd_favorite_modal" tabindex="-1" role="dialog" aria-labelledby="dmd_favorite_modalLabel">
<div class="modal-dialog" role="... | You only need the\_content filter to add the modal, but bootstrap.js is needed to make it work.
```
add_action('wp_enqueue_scripts', array($this, 'enqueue_bootstrap');
public function enqueue_bootstrap(){
wp_register_script( 'bootstrap', plugins_url( 'your-plugin/assets/js/bootstrap.min.js' ) );
wp_enqueue_sc... |
241,790 | <p>The idea here is to be able to use the Link button to search through posts as usual, but, once selected, use the shortlink (with something like <code>wp_get_shortlink();</code>) instead of the permalink:</p>
<p><code><a href="http://example.com/?p=1234">The Link</a></code></p>
<p>Not sure if it would b... | [
{
"answer_id": 241799,
"author": "T.Todua",
"author_id": 33667,
"author_profile": "https://wordpress.stackexchange.com/users/33667",
"pm_score": 0,
"selected": false,
"text": "<p>You'd go with new button, which will place i.e. <code>[post_shrtl]</code> anywhere in content area (or you ca... | 2016/10/06 | [
"https://wordpress.stackexchange.com/questions/241790",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/86280/"
] | The idea here is to be able to use the Link button to search through posts as usual, but, once selected, use the shortlink (with something like `wp_get_shortlink();`) instead of the permalink:
`<a href="http://example.com/?p=1234">The Link</a>`
Not sure if it would be easier to add this function to the existing butto... | If you mean the *link dialog*, then we can modify the *permalinks* with the [`wp_link_query`](https://developer.wordpress.org/reference/hooks/wp_link_query/) filter:
```
add_filter( 'wp_link_query', function( $results )
{
foreach( $results as &$result )
$result['permalink'] = wp_get_shortlink( $result['ID'... |
241,814 | <p>When you request posts using WP API's search mechanism, it returns tags as one of the post's properties, but it is an array of tag IDs, not tag names. Is there a way to make the API include the name of the tags without making subsequent requests to the API by tag ID for each one?</p>
<pre><code>tags: [
188,
... | [
{
"answer_id": 241819,
"author": "The Unknown Dev",
"author_id": 102669,
"author_profile": "https://wordpress.stackexchange.com/users/102669",
"pm_score": 4,
"selected": true,
"text": "<p>I figured something out based on what I found at this <a href=\"https://www.haselt.com/blog/wp-rest-... | 2016/10/06 | [
"https://wordpress.stackexchange.com/questions/241814",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/102669/"
] | When you request posts using WP API's search mechanism, it returns tags as one of the post's properties, but it is an array of tag IDs, not tag names. Is there a way to make the API include the name of the tags without making subsequent requests to the API by tag ID for each one?
```
tags: [
188,
30,
151,
... | I figured something out based on what I found at this [post](https://www.haselt.com/blog/wp-rest-api-modifying-the-json-response).
Basically I need a plugin that listens for when the REST response is about to go out. The plugin code would be similar to the following:
```
function ag_filter_post_json($response, $post,... |
241,828 | <p>I need to create an excerpt that doesn't stop with an orphan word such as:</p>
<p><em>All I’ve got to do is pass as an ordinary human being. Simple. What could possibly go wrong? Did I mention we have comfy chairs? I’m the Doctor, I’m worse than everyone’s aunt. catches himself And that is not how I’m introducing m... | [
{
"answer_id": 241836,
"author": "cowgill",
"author_id": 5549,
"author_profile": "https://wordpress.stackexchange.com/users/5549",
"pm_score": 1,
"selected": false,
"text": "<p>Use this function instead. Then put <code>the_excerpt();</code> in your template.</p>\n\n<pre><code>/**\n * Fin... | 2016/10/06 | [
"https://wordpress.stackexchange.com/questions/241828",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/56854/"
] | I need to create an excerpt that doesn't stop with an orphan word such as:
*All I’ve got to do is pass as an ordinary human being. Simple. What could possibly go wrong? Did I mention we have comfy chairs? I’m the Doctor, I’m worse than everyone’s aunt. catches himself And that is not how I’m introducing myself.You hit... | Use this function instead. Then put `the_excerpt();` in your template.
```
/**
* Find the last period in the excerpt and remove everything after it.
* If no period is found, just return the entire excerpt.
*
* @param string $excerpt The post excerpt.
*/
function end_with_sentence( $excerpt ) {
if ( ( $pos = mb... |
241,837 | <p>This is the message that I got shortly after I clicked on the option to upgrade to the newest version of Wordpress. I made the mistake of NOT backing up my files somewhere and now I am wondering if I have to rebuild the site from scratch. I do not have direct access to the host server. What do you advise?</p>
<p>Fa... | [
{
"answer_id": 241836,
"author": "cowgill",
"author_id": 5549,
"author_profile": "https://wordpress.stackexchange.com/users/5549",
"pm_score": 1,
"selected": false,
"text": "<p>Use this function instead. Then put <code>the_excerpt();</code> in your template.</p>\n\n<pre><code>/**\n * Fin... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241837",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104412/"
] | This is the message that I got shortly after I clicked on the option to upgrade to the newest version of Wordpress. I made the mistake of NOT backing up my files somewhere and now I am wondering if I have to rebuild the site from scratch. I do not have direct access to the host server. What do you advise?
Fatal error:... | Use this function instead. Then put `the_excerpt();` in your template.
```
/**
* Find the last period in the excerpt and remove everything after it.
* If no period is found, just return the entire excerpt.
*
* @param string $excerpt The post excerpt.
*/
function end_with_sentence( $excerpt ) {
if ( ( $pos = mb... |
241,854 | <p>I've implemented some AJAX functionality for my plugin and it works fine as long as I'm not logged in as admin - then <code>wp_verify_nonce</code> fails. It works for unauthorized users and authorized regular users too.</p>
<p>Here's my PHP class (I removed everything that is not relevant to the issue):</p>
<pre><... | [
{
"answer_id": 241871,
"author": "cybmeta",
"author_id": 37428,
"author_profile": "https://wordpress.stackexchange.com/users/37428",
"pm_score": 2,
"selected": false,
"text": "<p>Ajax URL in WordPress is something like this <code>https://examle.com/wp-admin/admin-ajax.php</code>. When yo... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241854",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/86509/"
] | I've implemented some AJAX functionality for my plugin and it works fine as long as I'm not logged in as admin - then `wp_verify_nonce` fails. It works for unauthorized users and authorized regular users too.
Here's my PHP class (I removed everything that is not relevant to the issue):
```
class My_Ajax {
functio... | I think the problem was that I manually deleted my cookies a few times while testing. Among them was a cookie called "wordpress\_logged\_in\_{token}" where {token} is an unique identifier. My best guess is that lack of this cookie caused issues with nonce creation or/and verification. It was hard to notice because I wa... |
241,867 | <p>many users would to allow the registration in a wp site without an username, just only with an email.</p>
<p>This is a core problem, so the solution (a trick) is to replace username with email.</p>
<p>If wp requires an username and an email for the registration, we can get email value and put it in username value.... | [
{
"answer_id": 241882,
"author": "websupporter",
"author_id": 48693,
"author_profile": "https://wordpress.stackexchange.com/users/48693",
"pm_score": 3,
"selected": true,
"text": "<p>You can use <code>@</code> and <code>.</code> in usernames, so there is no problem. Now you could create ... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241867",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104428/"
] | many users would to allow the registration in a wp site without an username, just only with an email.
This is a core problem, so the solution (a trick) is to replace username with email.
If wp requires an username and an email for the registration, we can get email value and put it in username value. In the registrat... | You can use `@` and `.` in usernames, so there is no problem. Now you could create your own register form and use [`register_new_user()`](https://codex.wordpress.org/Function_Reference/register_new_user). You could even manipulate [`wp_registration_url()`](https://codex.wordpress.org/Function_Reference/wp_registration_... |
241,878 | <p>I have lots of Word documents that form training materials for work. I would like to develop a website to act as a repository for these documents. However, rather than just store them on a web server and provide links to the files, I would like (if possible) for the visitor to be able to view the documents via the w... | [
{
"answer_id": 241896,
"author": "isaacsgraphic",
"author_id": 89562,
"author_profile": "https://wordpress.stackexchange.com/users/89562",
"pm_score": 1,
"selected": false,
"text": "<p>If you don't need the users to be able to edit the word documents, it might be a good option to save th... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241878",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/39292/"
] | I have lots of Word documents that form training materials for work. I would like to develop a website to act as a repository for these documents. However, rather than just store them on a web server and provide links to the files, I would like (if possible) for the visitor to be able to view the documents via the webs... | The real problem here is the download offer. Let's separate the two tasks first, to see that better.
Upload
------
### 1. … from Word directly
Word can communicate with WordPress directly per `xmlrpc.php`. When you ope a new file, select **Blog post** as template, then enter your user credentials once. Word will rem... |
241,879 | <p>I am trying to access data from another website to display on a WordPress Website I am developing. So far I have the following:</p>
<pre><code><?php
/*
Template Name: Testing remote data
*/
get_header();
<div class="main">
<div class="col-sm-12">
<header>
&... | [
{
"answer_id": 264658,
"author": "Aishan",
"author_id": 89530,
"author_profile": "https://wordpress.stackexchange.com/users/89530",
"pm_score": 0,
"selected": false,
"text": "<p>you can access data from other website via RSS feed. \nYou can see the RSS feed of bbc news in the following u... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241879",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/82982/"
] | I am trying to access data from another website to display on a WordPress Website I am developing. So far I have the following:
```
<?php
/*
Template Name: Testing remote data
*/
get_header();
<div class="main">
<div class="col-sm-12">
<header>
<h2>Testing remote data</h2>
<... | ```
// make request... (optionally save in transient for faster future fetches)
$dom = new DOMDocument();
$dom->loadHTML(wp_remote_retrieve_body($request));
$sections=$dom->getElementsByTagName("section");
foreach ($sections as $section) {
// Do something...
}
``` |
241,880 | <p>Before deciding to ask this question, I googled and searched this forum, but found no answer to my question, even though it may seem like a duplicate.</p>
<p>Anyway, I made custom post type that uses its featured image. Now, I would like to set if no featured image exists, show post content and by that I mean show ... | [
{
"answer_id": 241885,
"author": "Nancy",
"author_id": 101279,
"author_profile": "https://wordpress.stackexchange.com/users/101279",
"pm_score": 0,
"selected": false,
"text": "<p>I managed to realize that I had two problems with my code on the page where I needed post content displayed:<... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241880",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101279/"
] | Before deciding to ask this question, I googled and searched this forum, but found no answer to my question, even though it may seem like a duplicate.
Anyway, I made custom post type that uses its featured image. Now, I would like to set if no featured image exists, show post content and by that I mean show whatever i... | the\_post\_thumbnail will echo out the thumbnail so maybe try
```
if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else {
the_content();
}
```
Hope this helps |
241,903 | <p>I would like to update only themes in my WP without enabling maintenance mode. Is it possible?</p>
| [
{
"answer_id": 241904,
"author": "cjbj",
"author_id": 75495,
"author_profile": "https://wordpress.stackexchange.com/users/75495",
"pm_score": 2,
"selected": false,
"text": "<p>Sure, just upload them to their directories with ftp. After all, updating themes is not much more than copying t... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241903",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/78021/"
] | I would like to update only themes in my WP without enabling maintenance mode. Is it possible? | 3 years later I solved this issue with this below shell script:
```
#Getting list of outdated themes
/usr/local/bin/wp theme list --update=available --allow-root --path=/var/www | sed -n '1!p' | awk '{print $1}' > /tmp/theme.list
#Update them one by one
while read -r themename
do
#Store the old version number of ... |
241,908 | <p>I have a WP Plugin where i use Font-Awesome Icons. I added the Font-Awesome folder to my Plugin Files and told WordPress to use them:</p>
<pre><code>// add font-awesome to admin area
function ecp_admin_enqueue($hook) {
// check if plugin page
global $ecp_settings_page;
if ( $hook != $ecp_settings_page )... | [
{
"answer_id": 241922,
"author": "wassereimer",
"author_id": 54551,
"author_profile": "https://wordpress.stackexchange.com/users/54551",
"pm_score": 1,
"selected": true,
"text": "<p>It was not Font-Awesome that changed the default WordPress Style. I also use Bootstrap. One file called sc... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241908",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/54551/"
] | I have a WP Plugin where i use Font-Awesome Icons. I added the Font-Awesome folder to my Plugin Files and told WordPress to use them:
```
// add font-awesome to admin area
function ecp_admin_enqueue($hook) {
// check if plugin page
global $ecp_settings_page;
if ( $hook != $ecp_settings_page ) {
ret... | It was not Font-Awesome that changed the default WordPress Style. I also use Bootstrap. One file called scaffolding.less overrides the WordPress defaults with:
```
// Body reset
html {
font-size: 10px;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
body {
font-family: @font-family-base;
font-size: @font-size-... |
241,921 | <p>after <a href="https://stackoverflow.com/questions/39920420/wordpress-strange-permission-issue">this problem</a> I think that there is a problem if I have two wordpress installation on one pc. I've fallow <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-multiple-wordpress-sites-on-a-single-ubu... | [
{
"answer_id": 241931,
"author": "Vasil Ivanov",
"author_id": 104459,
"author_profile": "https://wordpress.stackexchange.com/users/104459",
"pm_score": -1,
"selected": false,
"text": "<p>So I was right and the problem was the alias so no one tell me how to resolve it. I thinking about ho... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241921",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104459/"
] | after [this problem](https://stackoverflow.com/questions/39920420/wordpress-strange-permission-issue) I think that there is a problem if I have two wordpress installation on one pc. I've fallow [this instruction](https://www.digitalocean.com/community/tutorials/how-to-set-up-multiple-wordpress-sites-on-a-single-ubuntu-... | So I was right and the problem was the alias so no one tell me how to resolve it. I thinking about how can I rename the wp-content for the second wordpress installation. I found a simple tutorial [here](http://www.hongkiat.com/blog/renaming-wordpress-wp-content-folder/) and after made everything from tutorial with the ... |
241,934 | <p>I've <a href="https://wordpress.org/plugins/remove-http/" rel="nofollow">created a plugin</a> that turns all links into protocol relative URLs, like so:</p>
<pre><code>http://example.com -> //example.com
</code></pre>
<p>I'm also adding a function to force HTTPS only if SSL is enabled and set up properly on the... | [
{
"answer_id": 241940,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 1,
"selected": false,
"text": "<p>There is no fail proof way to know if the site support https without actually trying to send a request ov... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241934",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98212/"
] | I've [created a plugin](https://wordpress.org/plugins/remove-http/) that turns all links into protocol relative URLs, like so:
```
http://example.com -> //example.com
```
I'm also adding a function to force HTTPS only if SSL is enabled and set up properly on the website. The following function below will force HTTPS... | Based on the comments, there is no foolproof way to check if someone's website has SSL set up correctly. Possible options include a setting in the plugin to have the user confirm that they have SSL set up.
However, one automated way is to check if the site URL has `https://` in it. This is assumed that SSL has been se... |
241,942 | <p>I've been trying to figure this out for about a week and I've got a few different methods that 'work' but I don't feel like are the best/right solutions for the project.</p>
<p>I'm trying to do the following:
I've got grid items that are populated via the WP Posts loop.
The grid items themselves are then wrapped in... | [
{
"answer_id": 241940,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 1,
"selected": false,
"text": "<p>There is no fail proof way to know if the site support https without actually trying to send a request ov... | 2016/10/07 | [
"https://wordpress.stackexchange.com/questions/241942",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104477/"
] | I've been trying to figure this out for about a week and I've got a few different methods that 'work' but I don't feel like are the best/right solutions for the project.
I'm trying to do the following:
I've got grid items that are populated via the WP Posts loop.
The grid items themselves are then wrapped in an tag wh... | Based on the comments, there is no foolproof way to check if someone's website has SSL set up correctly. Possible options include a setting in the plugin to have the user confirm that they have SSL set up.
However, one automated way is to check if the site URL has `https://` in it. This is assumed that SSL has been se... |
241,961 | <p>With wordpress 4.6.1 is it possible to create a child theme layout of the wp-login page with its own CSS this way original wp-login page and it's defaults are preserved?</p>
<p>How can I hook into the head of this page for custom stylesheets and hook into the body for custom html?</p>
| [
{
"answer_id": 242334,
"author": "brianjohnhanna",
"author_id": 65403,
"author_profile": "https://wordpress.stackexchange.com/users/65403",
"pm_score": 3,
"selected": true,
"text": "<p>In <code>functions.php</code> in your child theme, you can do a couple different things on the login sc... | 2016/10/08 | [
"https://wordpress.stackexchange.com/questions/241961",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98671/"
] | With wordpress 4.6.1 is it possible to create a child theme layout of the wp-login page with its own CSS this way original wp-login page and it's defaults are preserved?
How can I hook into the head of this page for custom stylesheets and hook into the body for custom html? | In `functions.php` in your child theme, you can do a couple different things on the login screen. First, you'll want to add a custom stylesheet by hooking into `login_enqueue_scripts`.
```
add_action( 'login_enqueue_scripts', 'wpse_login_styles' );
function wpse_login_styles() {
wp_enqueue_style( 'wpse-custom-logi... |
241,996 | <p>I am using ajax in wordpress , i have done every thing right please update me why i ajax returning zero even if code is correct is there something else in the page which is forcing ajax to return 0. her eis my code for js</p>
<pre><code> jQuery('#seller-shop').on('focusout', function() {
var self = jQuery(t... | [
{
"answer_id": 242001,
"author": "Andy Macaulay-Brook",
"author_id": 94267,
"author_profile": "https://wordpress.stackexchange.com/users/94267",
"pm_score": -1,
"selected": true,
"text": "<p>Your Ajax hooked function is:</p>\n\n<pre><code>function wk_check_myshop_value() { echo \"asdasd\... | 2016/10/08 | [
"https://wordpress.stackexchange.com/questions/241996",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103243/"
] | I am using ajax in wordpress , i have done every thing right please update me why i ajax returning zero even if code is correct is there something else in the page which is forcing ajax to return 0. her eis my code for js
```
jQuery('#seller-shop').on('focusout', function() {
var self = jQuery(this);
... | Your Ajax hooked function is:
```
function wk_check_myshop_value() { echo "asdasd"; die;}
```
Try changing `die;` to `die();` |
242,023 | <p>I know how to use <a href="https://codex.wordpress.org/Customizing_the_Read_More" rel="nofollow">read more technique</a> to only view an excerpt of the topic on the homepage and click on the read more icon to open the post and view the full content.</p>
<p>Can we do it on the post itself? When the visitor open the... | [
{
"answer_id": 242041,
"author": "Dmitry Gamolin",
"author_id": 86509,
"author_profile": "https://wordpress.stackexchange.com/users/86509",
"pm_score": 2,
"selected": false,
"text": "<p>The solution might depend on why exactly you want it to work that way on the post page. But probably t... | 2016/10/08 | [
"https://wordpress.stackexchange.com/questions/242023",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104522/"
] | I know how to use [read more technique](https://codex.wordpress.org/Customizing_the_Read_More) to only view an excerpt of the topic on the homepage and click on the read more icon to open the post and view the full content.
Can we do it on the post itself? When the visitor open the post page itself (not the homepage),... | The solution might depend on why exactly you want it to work that way on the post page. But probably the best way would be to do this on the client side.
**Method with maximum height**
Let's say your post template has its content like this:
```
<div id="content"><?php the_content(); ?></div>
```
You need to add a ... |
242,033 | <p>Defining Open Graph meta tags like this for images.</p>
<pre><code>global $post;
$postImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 1200, 9999 ), false );
<meta property="og:image" content="<?php echo $postImg[0]; ?>"/>
<meta property="og:image:width" content="<?p... | [
{
"answer_id": 242041,
"author": "Dmitry Gamolin",
"author_id": 86509,
"author_profile": "https://wordpress.stackexchange.com/users/86509",
"pm_score": 2,
"selected": false,
"text": "<p>The solution might depend on why exactly you want it to work that way on the post page. But probably t... | 2016/10/08 | [
"https://wordpress.stackexchange.com/questions/242033",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101510/"
] | Defining Open Graph meta tags like this for images.
```
global $post;
$postImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 1200, 9999 ), false );
<meta property="og:image" content="<?php echo $postImg[0]; ?>"/>
<meta property="og:image:width" content="<?php echo $postImg[1]; ?>"/>
<meta pr... | The solution might depend on why exactly you want it to work that way on the post page. But probably the best way would be to do this on the client side.
**Method with maximum height**
Let's say your post template has its content like this:
```
<div id="content"><?php the_content(); ?></div>
```
You need to add a ... |
242,068 | <p>Is it possible to limit maximum menu depth in admin panel <code>/nav-menus.php</code>?</p>
<p>I need this because my theme won't support more than two levels of menu, so there is no point in allowing a user to make deeper menus.</p>
| [
{
"answer_id": 242078,
"author": "jmarceli",
"author_id": 81890,
"author_profile": "https://wordpress.stackexchange.com/users/81890",
"pm_score": 4,
"selected": false,
"text": "<p>The solution that I came up with:</p>\n\n<pre><code>/**\n * Limit max menu depth in admin panel to 2\n */\nf... | 2016/10/09 | [
"https://wordpress.stackexchange.com/questions/242068",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/81890/"
] | Is it possible to limit maximum menu depth in admin panel `/nav-menus.php`?
I need this because my theme won't support more than two levels of menu, so there is no point in allowing a user to make deeper menus. | Follow up on @jmarceli's and @squarecandy's great answers. Here is a solution that allows for:
* Easier scaling (set an object in the php action)
* Updates to the correct menu depth when the location checkboxes are changed
```
/**
* Limit max menu depth in admin panel
*/
function limit_admin_menu_depth($hook)
{
... |
242,141 | <p>I used these code in my theme's <code>functions.php</code> to logout a particular user with user <strong><em>id 233</em></strong> from everywhere in WordPress and it worked. But I want to logout all the users on my site from everywhere.</p>
<pre><code>// worked for user with user id 233
$sessions = WP_Session_Token... | [
{
"answer_id": 242142,
"author": "Dmitry Gamolin",
"author_id": 86509,
"author_profile": "https://wordpress.stackexchange.com/users/86509",
"pm_score": 0,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>$sessions = WP_Session_Tokens::get_instance( get_current_user_id() );\n$se... | 2016/10/10 | [
"https://wordpress.stackexchange.com/questions/242141",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104549/"
] | I used these code in my theme's `functions.php` to logout a particular user with user ***id 233*** from everywhere in WordPress and it worked. But I want to logout all the users on my site from everywhere.
```
// worked for user with user id 233
$sessions = WP_Session_Tokens::get_instance($user_id=233);
$sessions->des... | Firstly if you'd just like everyone to have to log in again you can void all of your cookies at once by changing your cookie hashes in your wordpress config file.
The lines that look like this:
```
define('AUTH_KEY', ':u(rb=Ys8*2x^rVisqX(9=10a*.euPdYEBo6p_ZBB2CDG|rv~Ju)sh+6@=L6p_:l');
define('SECURE_AUTH_KEY'... |
242,170 | <p>I've looked at many WP development forums but I couldn't find any answer, unfortunately. If anybody can help me. Actually, I am not sure if that kind of problem can be solved with WordPress at all. </p>
<p>My problem is the following.</p>
<p>When creating a new user in WordPress admin, the admin is offered a scree... | [
{
"answer_id": 242142,
"author": "Dmitry Gamolin",
"author_id": 86509,
"author_profile": "https://wordpress.stackexchange.com/users/86509",
"pm_score": 0,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>$sessions = WP_Session_Tokens::get_instance( get_current_user_id() );\n$se... | 2016/10/10 | [
"https://wordpress.stackexchange.com/questions/242170",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104598/"
] | I've looked at many WP development forums but I couldn't find any answer, unfortunately. If anybody can help me. Actually, I am not sure if that kind of problem can be solved with WordPress at all.
My problem is the following.
When creating a new user in WordPress admin, the admin is offered a screen like the photo ... | Firstly if you'd just like everyone to have to log in again you can void all of your cookies at once by changing your cookie hashes in your wordpress config file.
The lines that look like this:
```
define('AUTH_KEY', ':u(rb=Ys8*2x^rVisqX(9=10a*.euPdYEBo6p_ZBB2CDG|rv~Ju)sh+6@=L6p_:l');
define('SECURE_AUTH_KEY'... |
242,196 | <p>I am using per_page instead of the filter since it is no more available. but the problem is per_page value can be between 1 and 100. what if I want to pull records and it is more that 100. per_page will not return records if the count is more than 100.
in the below API I want to pull the images which are more than 1... | [
{
"answer_id": 242205,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": -1,
"selected": false,
"text": "<p>Limits are there for a reason, before trying to overcome them you should ask yourself, \"why is there a ... | 2016/10/10 | [
"https://wordpress.stackexchange.com/questions/242196",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104400/"
] | I am using per\_page instead of the filter since it is no more available. but the problem is per\_page value can be between 1 and 100. what if I want to pull records and it is more that 100. per\_page will not return records if the count is more than 100.
in the below API I want to pull the images which are more than 1... | Add a page number query to your request URL, and continue querying next page numbers until you get an empty result:
```
<your_wordpress_install_base_url>/wp-json/wp/v2/media/?per_page=100&page=2
```
Mark's suggestion to consider requesting less than 100 per page may be a good one. So for example you may want to do y... |
242,197 | <p>I've noticed that WordPress seems a little loosey goosey when it comes to quoting styles in the HTML it generates. Sometimes WordPress uses single quotes, other times it uses double quotes</p>
<pre><code><link rel='next' title='An Example' href='http://example.com/foo/' />
<link rel="canonical" href="htt... | [
{
"answer_id": 242200,
"author": "db306",
"author_id": 90056,
"author_profile": "https://wordpress.stackexchange.com/users/90056",
"pm_score": 3,
"selected": true,
"text": "<p>First of all, either quotes are as good as each other. See <a href=\"https://stackoverflow.com/questions/2373074... | 2016/10/10 | [
"https://wordpress.stackexchange.com/questions/242197",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33566/"
] | I've noticed that WordPress seems a little loosey goosey when it comes to quoting styles in the HTML it generates. Sometimes WordPress uses single quotes, other times it uses double quotes
```
<link rel='next' title='An Example' href='http://example.com/foo/' />
<link rel="canonical" href="http://example.com/foo/" />... | First of all, either quotes are as good as each other. See [this question](https://stackoverflow.com/questions/2373074/single-vs-double-quotes-vs)
There is no way you can do this with a plugin, action or filter. To achieve this you will have to do this manually by using the "find and replace" option on your IDE. I do ... |
242,206 | <p>I am trying to show a Formidable Pro Form from a WordPress site to the other.
I followed the developer's API and the REST API, but faced a CORS problem.</p>
<p>Then I found a suggestion on a forum thread suggesting to add this line of code the <code>functions.php</code> of the site where the original form is:</p>
... | [
{
"answer_id": 242321,
"author": "Jesús Franco",
"author_id": 16301,
"author_profile": "https://wordpress.stackexchange.com/users/16301",
"pm_score": 4,
"selected": true,
"text": "<p>Yes, you open your site to being requested via AJAX to any other script in the whole web.</p>\n\n<p>It wo... | 2016/10/10 | [
"https://wordpress.stackexchange.com/questions/242206",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/91570/"
] | I am trying to show a Formidable Pro Form from a WordPress site to the other.
I followed the developer's API and the REST API, but faced a CORS problem.
Then I found a suggestion on a forum thread suggesting to add this line of code the `functions.php` of the site where the original form is:
`header("Access-Control-A... | Yes, you open your site to being requested via AJAX to any other script in the whole web.
It would be better if you limit the origin to **one** specific remote domain from which you are consuming the API, like [this example](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Access-Control-Allow-Ori... |
242,256 | <p>I am attempting to create customizable theme for my clients. The goal is to enable them to modify certain styles inside the theme customizer.</p>
<p>I didn't want to insert customizer's variables inside html code, but instead created a <code>css-php</code> file. Everything works well except that live preview of the... | [
{
"answer_id": 242326,
"author": "Miles Elliott",
"author_id": 104700,
"author_profile": "https://wordpress.stackexchange.com/users/104700",
"pm_score": 1,
"selected": false,
"text": "<p>You will want to put the code in the child theme, otherwise an update to the parent theme will erase ... | 2016/10/11 | [
"https://wordpress.stackexchange.com/questions/242256",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103317/"
] | I am attempting to create customizable theme for my clients. The goal is to enable them to modify certain styles inside the theme customizer.
I didn't want to insert customizer's variables inside html code, but instead created a `css-php` file. Everything works well except that live preview of the changes doesn't refl... | You will want to put the code in the child theme, otherwise an update to the parent theme will erase it.
You want the loader to be a part of the page as the document is first loaded by the browser, then use javascript to detect when the images are finished loading and remove the loader.
Check out these resources that... |
242,278 | <p>I have a desktop app and I use <strong>$.getJSON</strong> to get data from my wordpress site using the plugin the <strong>WP REST API</strong>. This works fine and so I assume I can also make an Ajax call to a function in the functions.php? How do I do this? None of the examples I have seen supply the ajaxURL. ... | [
{
"answer_id": 242279,
"author": "Tex0gen",
"author_id": 97070,
"author_profile": "https://wordpress.stackexchange.com/users/97070",
"pm_score": 4,
"selected": true,
"text": "<pre><code>//ajax call \nvar data = {\n action: 'folder_contents',\n path: datafolder\n};\nvar ajaxurl = ba... | 2016/10/11 | [
"https://wordpress.stackexchange.com/questions/242278",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70019/"
] | I have a desktop app and I use **$.getJSON** to get data from my wordpress site using the plugin the **WP REST API**. This works fine and so I assume I can also make an Ajax call to a function in the functions.php? How do I do this? None of the examples I have seen supply the ajaxURL. How do I find out what this is?
I... | ```
//ajax call
var data = {
action: 'folder_contents',
path: datafolder
};
var ajaxurl = baseurl + ''; //WHAT IS THIS?!?!
jQuery.post(ajaxurl, data, function(response) {
alert('Got this from the server: ' + response);
console.log(response);
});
```
And your PHP in functions.php
```
//Called by Aja... |