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
253,486
<p>How do I listen for and receive a third party HTTP POST in Wordpress so I can process the data in the post inside Wordpress? </p> <p>Not looking for the answer with code but rather the method by which Wordpress would receive that HTTP POST.</p>
[ { "answer_id": 253489, "author": "Cdorob", "author_id": 111460, "author_profile": "https://wordpress.stackexchange.com/users/111460", "pm_score": 1, "selected": false, "text": "<p>You should start by making a new page template starting from a template you already have in the theme (edit ...
2017/01/22
[ "https://wordpress.stackexchange.com/questions/253486", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/108215/" ]
How do I listen for and receive a third party HTTP POST in Wordpress so I can process the data in the post inside Wordpress? Not looking for the answer with code but rather the method by which Wordpress would receive that HTTP POST.
Easy! You have a couple of options to do so. The easiest one, but less safe, is to create a brand new PHP file in the root folder of WordPress. Let's say we will call it `get_post.php` and add WordPress functionality to it. Like so: ``` <?php require_once('wp-load.php'); // add wordpress functionality $pos...
253,491
<p>I am trying to create a custom loop to display my posts in different styling.</p> <p>In my posts, I have mostly Youtube videos and some text around. In my posts loop I need to display only thumbnail of the featured image of the posts and the text, but I don't want to display any iframes with my Youtube videos.</p> ...
[ { "answer_id": 253489, "author": "Cdorob", "author_id": 111460, "author_profile": "https://wordpress.stackexchange.com/users/111460", "pm_score": 1, "selected": false, "text": "<p>You should start by making a new page template starting from a template you already have in the theme (edit ...
2017/01/22
[ "https://wordpress.stackexchange.com/questions/253491", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111498/" ]
I am trying to create a custom loop to display my posts in different styling. In my posts, I have mostly Youtube videos and some text around. In my posts loop I need to display only thumbnail of the featured image of the posts and the text, but I don't want to display any iframes with my Youtube videos. I was searchi...
Easy! You have a couple of options to do so. The easiest one, but less safe, is to create a brand new PHP file in the root folder of WordPress. Let's say we will call it `get_post.php` and add WordPress functionality to it. Like so: ``` <?php require_once('wp-load.php'); // add wordpress functionality $pos...
253,508
<p>I want to get rid of a dash '-' in my Wordpress site title on mobile. To do that, I want to place a span around the dash, something like the below.</p> <p><strong>Desired Result</strong></p> <pre><code>&lt;h1 class="site-title"&gt;My Site Title &lt;span class="remove-mob"&gt;-&lt;/span&gt; Is Great&lt;/h1&gt; </co...
[ { "answer_id": 253489, "author": "Cdorob", "author_id": 111460, "author_profile": "https://wordpress.stackexchange.com/users/111460", "pm_score": 1, "selected": false, "text": "<p>You should start by making a new page template starting from a template you already have in the theme (edit ...
2017/01/22
[ "https://wordpress.stackexchange.com/questions/253508", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/91067/" ]
I want to get rid of a dash '-' in my Wordpress site title on mobile. To do that, I want to place a span around the dash, something like the below. **Desired Result** ``` <h1 class="site-title">My Site Title <span class="remove-mob">-</span> Is Great</h1> ``` Here's my current PHP code, can anyone suggest an edit, ...
Easy! You have a couple of options to do so. The easiest one, but less safe, is to create a brand new PHP file in the root folder of WordPress. Let's say we will call it `get_post.php` and add WordPress functionality to it. Like so: ``` <?php require_once('wp-load.php'); // add wordpress functionality $pos...
253,509
<p>I have 2 loops on the archive page. I want the first loop to display the 2 last posts of the category and the second loop offset 2 last post!</p> <pre><code>&lt;div class="top-posts"&gt; &lt;?php if (have_posts()) : while(have_posts()) : the_post();?&gt; &lt;div class="content"&gt; ...
[ { "answer_id": 253489, "author": "Cdorob", "author_id": 111460, "author_profile": "https://wordpress.stackexchange.com/users/111460", "pm_score": 1, "selected": false, "text": "<p>You should start by making a new page template starting from a template you already have in the theme (edit ...
2017/01/22
[ "https://wordpress.stackexchange.com/questions/253509", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/107899/" ]
I have 2 loops on the archive page. I want the first loop to display the 2 last posts of the category and the second loop offset 2 last post! ``` <div class="top-posts"> <?php if (have_posts()) : while(have_posts()) : the_post();?> <div class="content"> <?php the_post_thumbn...
Easy! You have a couple of options to do so. The easiest one, but less safe, is to create a brand new PHP file in the root folder of WordPress. Let's say we will call it `get_post.php` and add WordPress functionality to it. Like so: ``` <?php require_once('wp-load.php'); // add wordpress functionality $pos...
253,515
<p>I'm trying to include a few custom fields I've created in my functions.php file so they're native to the theme I'm working on. However they're not showing up on the edit screens of the posts I've set them to.</p> <p>I've included the acf plugin in my theme by using this code in my functions.php: include_once('advan...
[ { "answer_id": 253489, "author": "Cdorob", "author_id": 111460, "author_profile": "https://wordpress.stackexchange.com/users/111460", "pm_score": 1, "selected": false, "text": "<p>You should start by making a new page template starting from a template you already have in the theme (edit ...
2017/01/22
[ "https://wordpress.stackexchange.com/questions/253515", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111147/" ]
I'm trying to include a few custom fields I've created in my functions.php file so they're native to the theme I'm working on. However they're not showing up on the edit screens of the posts I've set them to. I've included the acf plugin in my theme by using this code in my functions.php: include\_once('advanced-custo...
Easy! You have a couple of options to do so. The easiest one, but less safe, is to create a brand new PHP file in the root folder of WordPress. Let's say we will call it `get_post.php` and add WordPress functionality to it. Like so: ``` <?php require_once('wp-load.php'); // add wordpress functionality $pos...
253,530
<p>I have created the post by user (A), later I changed the user of the post to (B), Now I want to find out who initially created the post i.e. user (A) who originally created it.</p> <p>How can I achieve this?</p>
[ { "answer_id": 253489, "author": "Cdorob", "author_id": 111460, "author_profile": "https://wordpress.stackexchange.com/users/111460", "pm_score": 1, "selected": false, "text": "<p>You should start by making a new page template starting from a template you already have in the theme (edit ...
2017/01/22
[ "https://wordpress.stackexchange.com/questions/253530", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80381/" ]
I have created the post by user (A), later I changed the user of the post to (B), Now I want to find out who initially created the post i.e. user (A) who originally created it. How can I achieve this?
Easy! You have a couple of options to do so. The easiest one, but less safe, is to create a brand new PHP file in the root folder of WordPress. Let's say we will call it `get_post.php` and add WordPress functionality to it. Like so: ``` <?php require_once('wp-load.php'); // add wordpress functionality $pos...
253,544
<p>I ran into mixed content with SSL issues. I've applied for Let's encrypt SSL certificate for my test wordpress site behind a reverse proxy(articaproxy).</p> <p>The same SSL certificate has been deployed in reverse proxy server and wordpress virtual host.</p> <p>The reverse proxy http/https redirect works fine.</p>...
[ { "answer_id": 253489, "author": "Cdorob", "author_id": 111460, "author_profile": "https://wordpress.stackexchange.com/users/111460", "pm_score": 1, "selected": false, "text": "<p>You should start by making a new page template starting from a template you already have in the theme (edit ...
2017/01/22
[ "https://wordpress.stackexchange.com/questions/253544", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111379/" ]
I ran into mixed content with SSL issues. I've applied for Let's encrypt SSL certificate for my test wordpress site behind a reverse proxy(articaproxy). The same SSL certificate has been deployed in reverse proxy server and wordpress virtual host. The reverse proxy http/https redirect works fine. I forced the siteur...
Easy! You have a couple of options to do so. The easiest one, but less safe, is to create a brand new PHP file in the root folder of WordPress. Let's say we will call it `get_post.php` and add WordPress functionality to it. Like so: ``` <?php require_once('wp-load.php'); // add wordpress functionality $pos...
253,559
<p>I use a very modern and fully-featured theme that has a lot of custom functions. Something like Avada, Enfold, etc.</p> <p>There's this function called <strong>medigroup_mikado_custom_breadcrumbs</strong> that's being called at <strong>wp-content/themes/mytheme/framework/modules/title/title-functions.php</strong> a...
[ { "answer_id": 253560, "author": "Tunji", "author_id": 54764, "author_profile": "https://wordpress.stackexchange.com/users/54764", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p><strong>Filters</strong> are one of the two types of Hooks.</p>\n \n <p>They provide a way fo...
2017/01/23
[ "https://wordpress.stackexchange.com/questions/253559", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27278/" ]
I use a very modern and fully-featured theme that has a lot of custom functions. Something like Avada, Enfold, etc. There's this function called **medigroup\_mikado\_custom\_breadcrumbs** that's being called at **wp-content/themes/mytheme/framework/modules/title/title-functions.php** and I'm trying to filter it in fun...
> > **Filters** are one of the two types of Hooks. > > > They provide a way for functions to modify data of other functions. > > > You can filter any function that has applied a filter on it's variables during the function definition. For example, in the [**`get_bloginfo`**](https://developer.wordpress.org/refe...
253,565
<p>I'm using a function to create additional fields on media upload. They are important only for images and videos, but useless and even confusing to my users if they are uploading audio.</p> <p>This is the function:</p> <pre><code>function give_linked_images_data($html, $id, $caption, $title, $align, $url, $size, $a...
[ { "answer_id": 253668, "author": "Daniel Lemes", "author_id": 31885, "author_profile": "https://wordpress.stackexchange.com/users/31885", "pm_score": 1, "selected": false, "text": "<p>I found out how:</p>\n\n<pre><code>$mime_type = get_post_mime_type($post-&gt;ID);\n// all mime https://c...
2017/01/23
[ "https://wordpress.stackexchange.com/questions/253565", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31885/" ]
I'm using a function to create additional fields on media upload. They are important only for images and videos, but useless and even confusing to my users if they are uploading audio. This is the function: ``` function give_linked_images_data($html, $id, $caption, $title, $align, $url, $size, $alt = '' ){ $class...
We can simplify the *mime type* checks, with the following *boolean* functions: * `wp_attachment_is( 'image', $id )` * `wp_attachment_is( 'video', $id )` * `wp_attachment_is( 'audio', $id )` where `$id` is the attachment ID. The attachment's ID is actually one of the input arguments for the `media_send_to_editor` f...
253,580
<p>i want author role can't access wp-admin but still enable the capabilities so they can delete the posts from front end page ?</p>
[ { "answer_id": 253592, "author": "mukto90", "author_id": 57944, "author_profile": "https://wordpress.stackexchange.com/users/57944", "pm_score": 3, "selected": true, "text": "<p>Use this code in your <code>functions.php</code> file or in a plugin-</p>\n\n<pre><code>function wpse_253580_p...
2017/01/23
[ "https://wordpress.stackexchange.com/questions/253580", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/107171/" ]
i want author role can't access wp-admin but still enable the capabilities so they can delete the posts from front end page ?
Use this code in your `functions.php` file or in a plugin- ``` function wpse_253580_prevent_author_access(){ if( current_user_can( 'author' ) && is_admin() ) { // do something here. maybe redirect to homepage wp_safe_redirect( get_bloginfo( 'url' ) ); } } add_action( 'admin_init', 'wpse_253580...
253,631
<p>I'm working on a theme and I am having trouble with loops/pagination breaks when using an offest. I looked online and tried to use only 1 loop (<a href="https://wordpress.stackexchange.com/questions/217618/two-custom-loops-pagination-offset">per this post</a>) but I'm having trouble making it work.</p> <p>I want to...
[ { "answer_id": 253622, "author": "fergbrain", "author_id": 111481, "author_profile": "https://wordpress.stackexchange.com/users/111481", "pm_score": 0, "selected": false, "text": "<p>If you've just moved to WP hosting, it might be an issue with the Jetpack Photon service. Disable that an...
2017/01/23
[ "https://wordpress.stackexchange.com/questions/253631", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111586/" ]
I'm working on a theme and I am having trouble with loops/pagination breaks when using an offest. I looked online and tried to use only 1 loop ([per this post](https://wordpress.stackexchange.com/questions/217618/two-custom-loops-pagination-offset)) but I'm having trouble making it work. I want to have the first 3 pos...
It is possible that there is lazy loading happening. Look at any plugins that may have an effect on page loads. For example, JetPack has an option to cache files as well as lazy load files. Another factor may be that the images are set to [progressively load](https://www.ionos.com/digitalguide/websites/web-design/prog...
253,638
<p>I have used this tutorial here (<a href="https://codex.wordpress.org/Integrating_WordPress_with_Your_Website" rel="nofollow noreferrer">https://codex.wordpress.org/Integrating_WordPress_with_Your_Website</a>) as a guide to set up non-wordpress pages to access some wordpress resources on non-wordpress pages. Eg I can...
[ { "answer_id": 253645, "author": "Md. Mrinal Haque", "author_id": 111354, "author_profile": "https://wordpress.stackexchange.com/users/111354", "pm_score": 1, "selected": false, "text": "<p>You are following <a href=\"https://codex.wordpress.org/Integrating_WordPress_with_Your_Website\" ...
2017/01/23
[ "https://wordpress.stackexchange.com/questions/253638", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/96667/" ]
I have used this tutorial here (<https://codex.wordpress.org/Integrating_WordPress_with_Your_Website>) as a guide to set up non-wordpress pages to access some wordpress resources on non-wordpress pages. Eg I can view posts with the code snippet below on non-wordpress page. ``` <?php require('/the/path/to/your/wp-blog-...
You are following <https://codex.wordpress.org/Integrating_WordPress_with_Your_Website> which means your main site is not basically WordPress. You use some features of WordPress like post publish, displaying etc. But, main site is not WordPress. For that reason, you can't detect a user is logged in or not in WordPress.
253,640
<p>I've done this previously but I've forgotten the name of the hook, and can't find it anywhere...</p> <p>What I'm trying to do is add some custom columns in the listing of a custom post type in the admin.</p> <p>For example, in the admin, click on <em>articles</em>, I want to add custom column there.</p>
[ { "answer_id": 253644, "author": "Dave Romsey", "author_id": 2807, "author_profile": "https://wordpress.stackexchange.com/users/2807", "pm_score": 8, "selected": true, "text": "<p>The hooks to create custom columns and their associated data for a custom post type are <code>manage_{$post_...
2017/01/23
[ "https://wordpress.stackexchange.com/questions/253640", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104711/" ]
I've done this previously but I've forgotten the name of the hook, and can't find it anywhere... What I'm trying to do is add some custom columns in the listing of a custom post type in the admin. For example, in the admin, click on *articles*, I want to add custom column there.
The hooks to create custom columns and their associated data for a custom post type are `manage_{$post_type}_posts_columns` and [`manage_{$post_type}_posts_custom_column`](https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column) respectively, where `{$post_type}` is the name of the custom pos...
253,652
<p>I'm using the <a href="https://wordpress.org/themes/hashone/" rel="nofollow noreferrer">HashOne theme</a> and created a child theme in order to make various color changes to our website.</p> <p>However, the changes I've made to the child theme stylesheet are only taking place in the certain sections of the site, wh...
[ { "answer_id": 253658, "author": "Michael Ecklund", "author_id": 9579, "author_profile": "https://wordpress.stackexchange.com/users/9579", "pm_score": 2, "selected": false, "text": "<p>You don't need to load the Style Sheet of your Child Theme unless you want to label it something other ...
2017/01/23
[ "https://wordpress.stackexchange.com/questions/253652", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111599/" ]
I'm using the [HashOne theme](https://wordpress.org/themes/hashone/) and created a child theme in order to make various color changes to our website. However, the changes I've made to the child theme stylesheet are only taking place in the certain sections of the site, while other changes are deferring to the parent t...
There's no need for more code in your functions.php file to enqueue the parent themes css from your child theme. The problem is that by adding that code, you're enqueueing the parent theme's CSS a second time, but it's now loading after the child theme. This means that all the changes you made in the child theme will h...
253,663
<p>I have a custom post type which needs to be in sync between two different websites housed in different servers. If either site edits, inserts, or deletes, the other database will also have to update its database for the change. The issue I see is, the ID's will be offset between the two databases.</p> <p>So my ratio...
[ { "answer_id": 253658, "author": "Michael Ecklund", "author_id": 9579, "author_profile": "https://wordpress.stackexchange.com/users/9579", "pm_score": 2, "selected": false, "text": "<p>You don't need to load the Style Sheet of your Child Theme unless you want to label it something other ...
2017/01/23
[ "https://wordpress.stackexchange.com/questions/253663", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/57241/" ]
I have a custom post type which needs to be in sync between two different websites housed in different servers. If either site edits, inserts, or deletes, the other database will also have to update its database for the change. The issue I see is, the ID's will be offset between the two databases. So my rationale is, ...
There's no need for more code in your functions.php file to enqueue the parent themes css from your child theme. The problem is that by adding that code, you're enqueueing the parent theme's CSS a second time, but it's now loading after the child theme. This means that all the changes you made in the child theme will h...
253,678
<p>I have just released my very first plugin and I’m very proud – but I am having a lot of troubles with the plugin preview</p> <p>So when I look here: <a href="https://wordpress.org/plugins/simple-popups/" rel="nofollow noreferrer">https://wordpress.org/plugins/simple-popups/</a> it looks just fine</p> <p>but when I...
[ { "answer_id": 253658, "author": "Michael Ecklund", "author_id": 9579, "author_profile": "https://wordpress.stackexchange.com/users/9579", "pm_score": 2, "selected": false, "text": "<p>You don't need to load the Style Sheet of your Child Theme unless you want to label it something other ...
2017/01/23
[ "https://wordpress.stackexchange.com/questions/253678", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111611/" ]
I have just released my very first plugin and I’m very proud – but I am having a lot of troubles with the plugin preview So when I look here: <https://wordpress.org/plugins/simple-popups/> it looks just fine but when I log into one of my websites and search for “simple popups” and click so the small preview window op...
There's no need for more code in your functions.php file to enqueue the parent themes css from your child theme. The problem is that by adding that code, you're enqueueing the parent theme's CSS a second time, but it's now loading after the child theme. This means that all the changes you made in the child theme will h...
253,724
<p>I have a query looping through all posts in a custom post type using a custom order (via a re-ordering plugin.)</p> <p>Here's my code:</p> <pre><code>&lt;?php $current_id = get_the_ID(); $counter = 0; $the_query = new WP_Query(array( 'posts_per_page' =&gt; -1, 'post_type' =&gt; 'course_...
[ { "answer_id": 253727, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>Set a variable to a classname before the loop:</p>\n\n<pre><code>$position = 'class-before';\n</code></pre>\n\n<p>...
2017/01/24
[ "https://wordpress.stackexchange.com/questions/253724", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109951/" ]
I have a query looping through all posts in a custom post type using a custom order (via a re-ordering plugin.) Here's my code: ``` <?php $current_id = get_the_ID(); $counter = 0; $the_query = new WP_Query(array( 'posts_per_page' => -1, 'post_type' => 'course_unit', 'orderby' => 'm...
A little bit of PHP can be used to determine if the current unit has been rendered or not. In the solution below, the flag `$current_unit_rendered` is initially set to false. We check to see if we're on the current unit. If so, we set the `$unit_class` variable to the appropriate string and update the flag. Using thi...
253,734
<p>When I access my WordPress site as <code>www.example.com/wp-json/</code> I got this 404 error.</p> <pre><code>`{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}` </code></pre> <p>But the REST api return the correct json object if I use the url of <cod...
[ { "answer_id": 256779, "author": "user113522", "author_id": 113522, "author_profile": "https://wordpress.stackexchange.com/users/113522", "pm_score": 2, "selected": false, "text": "<p>Just ran into the same issue on an nginx only (no Apache) WordPress blank install 4.7.2 site.</p>\n\n<p>...
2017/01/24
[ "https://wordpress.stackexchange.com/questions/253734", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111577/" ]
When I access my WordPress site as `www.example.com/wp-json/` I got this 404 error. ``` `{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}` ``` But the REST api return the correct json object if I use the url of `www.example.com/wp-json/wp/v2/`. My pe...
Could this be about <https://core.trac.wordpress.org/ticket/39432> Symptoms look very similar and at the time of writing hasn't been released as 4.7.3. Applying the patch manually fixed the issue on my nginx setup.
253,735
<p>My sites are so slow running on my local machine, with MAMP on Mac.</p> <p>Any ideas of how to determine where the slow down is?</p> <p>It's slower than making changes on my host!</p> <p>Paul</p>
[ { "answer_id": 255179, "author": "user112547", "author_id": 112547, "author_profile": "https://wordpress.stackexchange.com/users/112547", "pm_score": 4, "selected": false, "text": "<p>Go to <strong>wp-config.php</strong>, find the line below:</p>\n\n<pre><code>define('DB_HOST', 'localhos...
2017/01/24
[ "https://wordpress.stackexchange.com/questions/253735", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/41425/" ]
My sites are so slow running on my local machine, with MAMP on Mac. Any ideas of how to determine where the slow down is? It's slower than making changes on my host! Paul
Go to **wp-config.php**, find the line below: ``` define('DB_HOST', 'localhost:8889'); ``` And change it to: ``` define('DB_HOST', '127.0.0.1:8889'); ``` Works like a charm!
253,743
<p>I have added alt tags, title and description on all the images on my website but none are showing when I check them in the inspect element tool in chrome or firefox.</p> <p>Here's a screenshot:</p> <p><a href="https://i.stack.imgur.com/hIgCG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hIgCG....
[ { "answer_id": 255179, "author": "user112547", "author_id": 112547, "author_profile": "https://wordpress.stackexchange.com/users/112547", "pm_score": 4, "selected": false, "text": "<p>Go to <strong>wp-config.php</strong>, find the line below:</p>\n\n<pre><code>define('DB_HOST', 'localhos...
2017/01/24
[ "https://wordpress.stackexchange.com/questions/253743", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106457/" ]
I have added alt tags, title and description on all the images on my website but none are showing when I check them in the inspect element tool in chrome or firefox. Here's a screenshot: [![enter image description here](https://i.stack.imgur.com/hIgCG.png)](https://i.stack.imgur.com/hIgCG.png) And here's the screens...
Go to **wp-config.php**, find the line below: ``` define('DB_HOST', 'localhost:8889'); ``` And change it to: ``` define('DB_HOST', '127.0.0.1:8889'); ``` Works like a charm!
253,803
<p>What is the best way to use "Output Buffering" on the frontend? In my case, I need to apply some regex rules to the content generated by a theme with a page builder. </p> <p>So it is not possible to edit the code with the filter <code>the_content</code>, because there everything is still available as shortcode. But...
[ { "answer_id": 253814, "author": "Ethan O'Sullivan", "author_id": 98212, "author_profile": "https://wordpress.stackexchange.com/users/98212", "pm_score": 0, "selected": false, "text": "<p>When I use <a href=\"https://secure.php.net/manual/en/function.ob-start.php\" rel=\"nofollow norefer...
2017/01/24
[ "https://wordpress.stackexchange.com/questions/253803", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111680/" ]
What is the best way to use "Output Buffering" on the frontend? In my case, I need to apply some regex rules to the content generated by a theme with a page builder. So it is not possible to edit the code with the filter `the_content`, because there everything is still available as shortcode. But I need to work with ...
If you simply want to modify content to be output by `the_content()` but after the shortcodes have been applied, there is a much simpler approach. Shortcodes are filtered in `the_content` with priority 11 as can be seen in [default-filters.php](https://core.trac.wordpress.org/browser/tags/4.7.1/src/wp-includes/default-...
253,820
<p>i use the following code in my functions.php. I want to exclude all pages which use the single.php template.</p> <pre><code>function cat_menu() { if (!is_page_template('single.php')) { $cur_cat = get_query_var('cat'); $new_cats = wp_list_categories('echo=false&amp;child_of=' . $cur_cat .'&amp;depth=1&amp;titl...
[ { "answer_id": 253822, "author": "swissspidy", "author_id": 12404, "author_profile": "https://wordpress.stackexchange.com/users/12404", "pm_score": 2, "selected": true, "text": "<p><code>is_page_template()</code> checks against post type templates specified by the theme using</p>\n\n<pre...
2017/01/24
[ "https://wordpress.stackexchange.com/questions/253820", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82174/" ]
i use the following code in my functions.php. I want to exclude all pages which use the single.php template. ``` function cat_menu() { if (!is_page_template('single.php')) { $cur_cat = get_query_var('cat'); $new_cats = wp_list_categories('echo=false&child_of=' . $cur_cat .'&depth=1&title_li=&&show_count=0&hide_em...
`is_page_template()` checks against post type templates specified by the theme using ``` /** * Template Name: My Template */ ``` at the top of the template file. Not any arbitrary template file. For this, you might wanna check out the answers over at [Get name of the current template file](https://wordpress.stacke...
253,847
<p>I've updated to wordpress 4.7.x. I don't know why, but after doing so, I no longer have the ability to upload plugins (it keeps asking for FTP access. We've never used FTP always SFTP), and I can no longer update existing plugins. I get this error:</p> <p><code>Update Failed: Could not create directory.</code></p> ...
[ { "answer_id": 253867, "author": "Kenneth Odle", "author_id": 111488, "author_profile": "https://wordpress.stackexchange.com/users/111488", "pm_score": 0, "selected": false, "text": "<p>If it's a WordPress, rather than an Apache error, you may not see anything on your server error logs. ...
2017/01/24
[ "https://wordpress.stackexchange.com/questions/253847", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37934/" ]
I've updated to wordpress 4.7.x. I don't know why, but after doing so, I no longer have the ability to upload plugins (it keeps asking for FTP access. We've never used FTP always SFTP), and I can no longer update existing plugins. I get this error: `Update Failed: Could not create directory.` wp-config.php indeed was...
In `wp-config.php`, set the following (if not already set): ``` define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 ); ``` This will make sure that on the site no error is shown, however, WordPress will log all errors in `debug.log` file insi...
253,896
<p>My (managed) dedicated server, with several sites (not all of which use WP) has been hacked.</p> <p>Obfuscated code has been appended to all files (including WP core/plugin/theme and non-WP stuff) for which the content begins with a php command (and not simply all files with a .php suffix).</p> <p>It doesn't seem ...
[ { "answer_id": 254011, "author": "Pedro Salazar", "author_id": 111785, "author_profile": "https://wordpress.stackexchange.com/users/111785", "pm_score": 0, "selected": false, "text": "<p>Have you considered engaging a MSSP for web servers? </p>\n\n<p>What you're describing is not uncommo...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253896", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103213/" ]
My (managed) dedicated server, with several sites (not all of which use WP) has been hacked. Obfuscated code has been appended to all files (including WP core/plugin/theme and non-WP stuff) for which the content begins with a php command (and not simply all files with a .php suffix). It doesn't seem to affect the ren...
> > My (managed) dedicated server, with several sites (not all of which use WP) has been hacked. > > > OK, it happens. Not the end of the world. --- > > Today, I find permissions changed to 200 - which I suspect might have been done by my service provider (although I've not received notification, nor yet an ans...
253,902
<p>How to hide deactivation link from all WordPress plugin page. </p> <p><a href="https://i.stack.imgur.com/wlCed.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wlCed.png" alt="enter image description here"></a></p>
[ { "answer_id": 253909, "author": "Morten Skogly", "author_id": 101970, "author_profile": "https://wordpress.stackexchange.com/users/101970", "pm_score": 0, "selected": false, "text": "<p>First: Why would you want that?</p>\n\n<p>If you run your wordpress install as a multisite/network, y...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253902", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111735/" ]
How to hide deactivation link from all WordPress plugin page. [![enter image description here](https://i.stack.imgur.com/wlCed.png)](https://i.stack.imgur.com/wlCed.png)
There is a filter called [`plugin_action_links`](https://developer.wordpress.org/reference/hooks/plugin_action_links/) that lets you do this. ``` function wpse253902_disable_plugin_deactivation ($actions, $plugin_file, $plugin_data, $context) { if (array_key_exists ('deactivate', $actions)) unset( $actions['deactiva...
253,905
<p>Is there a way to set default visible columns in posts list, for all users?</p> <p><a href="https://i.stack.imgur.com/xYWBU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xYWBU.png" alt="enter image description here"></a></p>
[ { "answer_id": 253912, "author": "JChario", "author_id": 111737, "author_profile": "https://wordpress.stackexchange.com/users/111737", "pm_score": 0, "selected": false, "text": "<p>To change the defaults, you simply need to hook into the default_hidden_meta_boxes filter and supply your o...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253905", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1210/" ]
Is there a way to set default visible columns in posts list, for all users? [![enter image description here](https://i.stack.imgur.com/xYWBU.png)](https://i.stack.imgur.com/xYWBU.png)
Since the question was about columns and not meta boxes and I needed this solution, Ioannis’ reply got me on the right track. The filter hook in question is `default_hidden_columns`. This is the solution I ended up with to set my `ad_shortcode` column to be hidden by default. You should know that this is just the def...
253,926
<p>In my wordpress website, I found several brand new file containing this php code:</p> <pre><code>if (isset($_REQUEST["q"]) AND $_REQUEST["q"]=="1"){echo "200"; exit;} if(isset($_POST["key"]) &amp;&amp; isset($_POST["chk"]) &amp;&amp; $_POST["key"]=="long_strange_code") eval(gzuncompress(base64_decode($_POST["chk"]...
[ { "answer_id": 253929, "author": "Samuel Asor", "author_id": 84265, "author_profile": "https://wordpress.stackexchange.com/users/84265", "pm_score": 0, "selected": false, "text": "<p>First, you need to check where the file is. Is it inside your theme folder or your plugins folder? </p>\n...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253926", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71652/" ]
In my wordpress website, I found several brand new file containing this php code: ``` if (isset($_REQUEST["q"]) AND $_REQUEST["q"]=="1"){echo "200"; exit;} if(isset($_POST["key"]) && isset($_POST["chk"]) && $_POST["key"]=="long_strange_code") eval(gzuncompress(base64_decode($_POST["chk"]))); ``` What this code can ...
> > What this code can do actually in Wordpress? > > > This code allows arbitrary execution of PHP on your server. > > Deleting the file is enough to remove the problem? > > > You'll need to delete all files that contain backdoor like this. Look at every file on your system and compare it to the WordPress r...
253,927
<p>I'm using this code in functions.php to hide/remove some pages from custom users backend and works well, but how can I reach to hide the subpages as well?</p> <pre><code>add_filter( 'parse_query' , 'exclude_pages_from_admin' ); function exclude_pages_from_admin($query) { global $pagenow,$post_type; if (is_admin(...
[ { "answer_id": 253942, "author": "Tunji", "author_id": 54764, "author_profile": "https://wordpress.stackexchange.com/users/54764", "pm_score": 1, "selected": false, "text": "<p>One way to achieve this is by looping through the parent pages and fetching their respective children pages ids...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253927", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111659/" ]
I'm using this code in functions.php to hide/remove some pages from custom users backend and works well, but how can I reach to hide the subpages as well? ``` add_filter( 'parse_query' , 'exclude_pages_from_admin' ); function exclude_pages_from_admin($query) { global $pagenow,$post_type; if (is_admin() && $pagenow ...
One way to achieve this is by looping through the parent pages and fetching their respective children pages ids. The resulting arrays can then be merged and used in the `'post__not_in'` variable. ``` add_filter( 'parse_query' , 'exclude_pages_from_admin' ); function exclude_pages_from_admin( $query ) { global ...
253,928
<p>This code works, and I want to understand why.</p> <p>So I created the object from the <code>WP_Query</code> class, and used the <code>have_posts()</code> and <code>the_post()</code> functions in a while loop. </p> <p>The question is: since the <strong><code>$post-&gt;ID</code></strong> is a data in an array based...
[ { "answer_id": 253931, "author": "Tunji", "author_id": 54764, "author_profile": "https://wordpress.stackexchange.com/users/54764", "pm_score": -1, "selected": false, "text": "<p>You can use <a href=\"https://developer.wordpress.org/reference/functions/get_the_id/\" rel=\"nofollow norefer...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253928", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111747/" ]
This code works, and I want to understand why. So I created the object from the `WP_Query` class, and used the `have_posts()` and `the_post()` functions in a while loop. The question is: since the **`$post->ID`** is a data in an array based on the class `WP_Post` would this than mean that the object instantiated fro...
Yes, an object containing other objects is "natural". A `House` object contains an array of `Furniture` objects in its `$furnitures` property... Such as in our case... [`WP_Query`](https://codex.wordpress.org/Class_Reference/WP_Query) contains an array of [`WP_Post`](https://codex.wordpress.org/Class_Reference/WP_Post)...
253,934
<p>I am building a quotes website and i have 2 main categories like <strong>Topic</strong> &amp; <strong>Authors</strong> <br> Every quote will have Author name and topic name and those are sub categories of Topic &amp; Author.<br> <strong>AND my question is</strong><br> i want to display only Author categories that is...
[ { "answer_id": 253931, "author": "Tunji", "author_id": 54764, "author_profile": "https://wordpress.stackexchange.com/users/54764", "pm_score": -1, "selected": false, "text": "<p>You can use <a href=\"https://developer.wordpress.org/reference/functions/get_the_id/\" rel=\"nofollow norefer...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253934", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111748/" ]
I am building a quotes website and i have 2 main categories like **Topic** & **Authors** Every quote will have Author name and topic name and those are sub categories of Topic & Author. **AND my question is** i want to display only Author categories that is a sub category of a Authors category please help me....
Yes, an object containing other objects is "natural". A `House` object contains an array of `Furniture` objects in its `$furnitures` property... Such as in our case... [`WP_Query`](https://codex.wordpress.org/Class_Reference/WP_Query) contains an array of [`WP_Post`](https://codex.wordpress.org/Class_Reference/WP_Post)...
253,950
<p>The Codex notes that <code>wp-config.php</code> can be used to over-ride file permissions by adding:</p> <pre><code>define('FS_CHMOD_FILE', 0644); define('FS_CHMOD_DIR', 0755); </code></pre> <p>Having done this... why then, when using an ftp app to view the permissions of a file, are they shown as different?</p> ...
[ { "answer_id": 253952, "author": "codiiv", "author_id": 91561, "author_profile": "https://wordpress.stackexchange.com/users/91561", "pm_score": 1, "selected": false, "text": "<p>1) Make sure the wp-config.php doesn't have multisite reference settings such as <code>define(\"DOMAIN_CURREN...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253950", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103213/" ]
The Codex notes that `wp-config.php` can be used to over-ride file permissions by adding: ``` define('FS_CHMOD_FILE', 0644); define('FS_CHMOD_DIR', 0755); ``` Having done this... why then, when using an ftp app to view the permissions of a file, are they shown as different? For example, by ftp I set `wp-config.php`...
1) Make sure the wp-config.php doesn't have multisite reference settings such as `define("DOMAIN_CURRENT_SITE", "somesite.com" );`. If it does, delete these settings 2) If you have updated `siteurl` and `home` settings in the `*_options` table to use local settings and it still doesn't work, then 3) Delete all theme...
253,974
<p>I set the pagination parameters in functions.php and echoed where I want the links to appear, so far so good.</p> <p>The problem is that the previous and next texts are not modifying. I put a random text to see what appears. The texts of the images below are shown, they are even translated into my language (pt-br)....
[ { "answer_id": 253979, "author": "Anwer AR", "author_id": 83820, "author_profile": "https://wordpress.stackexchange.com/users/83820", "pm_score": 2, "selected": false, "text": "<p>are you using WordPress in default <code>\"en\"</code> language? there might be a translations of <code>prev...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253974", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111513/" ]
I set the pagination parameters in functions.php and echoed where I want the links to appear, so far so good. The problem is that the previous and next texts are not modifying. I put a random text to see what appears. The texts of the images below are shown, they are even translated into my language (pt-br)... How ca...
I found out a way that you can place any text. You just need to create an array where you want the paginate\_links to appear. ``` <!-- Put this in your functions.php --> <?php $args = array( 'base' => '%_%', 'format' => '?paged=%#%', 'total' => 1, 'current' ...
253,994
<p>Working in WordPress PHP I am trying to pass a value into class tag of an element</p> <blockquote> <pre><code>&lt;div class="element-item"&gt;&lt;/div&gt; </code></pre> </blockquote> <p>to be like </p> <blockquote> <p><code>&lt;div class="element-item comedy"&gt;&lt;/div&gt;</code></p> </blockquote> <pre><code...
[ { "answer_id": 253999, "author": "qworx", "author_id": 111778, "author_profile": "https://wordpress.stackexchange.com/users/111778", "pm_score": 0, "selected": false, "text": "<pre><code>echo '&lt;div class=\"element-item '.$term.'\"&gt;';\n</code></pre>\n\n<p>Seems like the ' is closing...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/253994", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31793/" ]
Working in WordPress PHP I am trying to pass a value into class tag of an element > > > ``` > <div class="element-item"></div> > > ``` > > to be like > > `<div class="element-item comedy"></div>` > > > ``` $term = get_the_term_list( get_the_ID(), 'type' ); echo '<div class="element-item '.$term.'">'; ```...
Right, that's because "get\_the\_term\_list" returns an html string of tags... Those won't work well as class attributes! : ) I suspect what you want is [wp\_get\_post\_terms](https://codex.wordpress.org/Function_Reference/wp_get_post_terms) instead: ``` $terms = wp_get_post_terms( get_the_ID(), 'type', array('fields...
254,016
<p>This should be easy right? Removing Archives and Meta from the sidebars of two of my main WP pages. I can't seem to! I've looked in <strong>Appearance > Widgets</strong> and made sure Archives and Meta was not appearing in any fields. I have checked my Theme's (<a href="https://wordpress.org/themes/fruitful/" rel="n...
[ { "answer_id": 254018, "author": "Dave Romsey", "author_id": 2807, "author_profile": "https://wordpress.stackexchange.com/users/2807", "pm_score": 1, "selected": false, "text": "<p>The theme is set up so that if a sidebar is inactive, default content will be shown (search form, monthly a...
2017/01/25
[ "https://wordpress.stackexchange.com/questions/254016", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111788/" ]
This should be easy right? Removing Archives and Meta from the sidebars of two of my main WP pages. I can't seem to! I've looked in **Appearance > Widgets** and made sure Archives and Meta was not appearing in any fields. I have checked my Theme's ([Fruitful](https://wordpress.org/themes/fruitful/)) options in Customiz...
The theme is set up so that if a sidebar is inactive, default content will be shown (search form, monthly archives, and meta). For example, the `sidebar.php` file: ``` <?php /** * The Sidebar containing the main widget areas. * * @package WordPress * @subpackage Fruitful theme * @since Fruitful theme 1.0 */ ?> ...
254,030
<p>I have a managed server with several WP and non-WP sites, and code has been prepended to the content of all files (for all domains on the sever) which begin with a php command.</p> <p>I'm wondering whether the cause was a vulnerability or password-guess in one WP install, or instead a guess of the ftp password or o...
[ { "answer_id": 254018, "author": "Dave Romsey", "author_id": 2807, "author_profile": "https://wordpress.stackexchange.com/users/2807", "pm_score": 1, "selected": false, "text": "<p>The theme is set up so that if a sidebar is inactive, default content will be shown (search form, monthly a...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254030", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103213/" ]
I have a managed server with several WP and non-WP sites, and code has been prepended to the content of all files (for all domains on the sever) which begin with a php command. I'm wondering whether the cause was a vulnerability or password-guess in one WP install, or instead a guess of the ftp password or other reaso...
The theme is set up so that if a sidebar is inactive, default content will be shown (search form, monthly archives, and meta). For example, the `sidebar.php` file: ``` <?php /** * The Sidebar containing the main widget areas. * * @package WordPress * @subpackage Fruitful theme * @since Fruitful theme 1.0 */ ?> ...
254,038
<p>I want to get all columns from all post types like this:</p> <pre><code>$postTypes = get_post_types(); $allColumns = array(); foreach($postTypes as $type){ $allColumns[$type] = get_post_type_columns($type); } function get_post_type_columns($type){ $columns = array(); //implement return $columns; } <...
[ { "answer_id": 254048, "author": "prosti", "author_id": 88606, "author_profile": "https://wordpress.stackexchange.com/users/88606", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p>How to actually get post type columns for a specific post type</p>\n</blockquote>\n\n<p>All po...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254038", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/108814/" ]
I want to get all columns from all post types like this: ``` $postTypes = get_post_types(); $allColumns = array(); foreach($postTypes as $type){ $allColumns[$type] = get_post_type_columns($type); } function get_post_type_columns($type){ $columns = array(); //implement return $columns; } ``` How to ac...
> > How to actually get post type columns for a specific post type > > > All post types should be inside the `wp_posts` table inside your database, if you haven't used the custom prefix. This table has the following structure. ``` Column Type Comment ID bigint(20) unsigned Auto Increment post_author bigi...
254,043
<p>Right now, I have a website that is using the Genesis theme. I'm trying to create a child theme, except I don't want to go through all the work of that. At the moment, I've downloaded a normal theme - gridz - and I want to make it a child theme. </p> <p>What I've tried to do so far is add <strong>Template: genesis<...
[ { "answer_id": 254047, "author": "Fabio Marzocca", "author_id": 65278, "author_profile": "https://wordpress.stackexchange.com/users/65278", "pm_score": 3, "selected": true, "text": "<p>I don't understand your target. If you want to create a child theme, it is quite easy and strightforwar...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254043", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111804/" ]
Right now, I have a website that is using the Genesis theme. I'm trying to create a child theme, except I don't want to go through all the work of that. At the moment, I've downloaded a normal theme - gridz - and I want to make it a child theme. What I've tried to do so far is add **Template: genesis** to the bottom ...
I don't understand your target. If you want to create a child theme, it is quite easy and strightforward; just follow these simple rules: <https://codex.wordpress.org/Child_Themes> Nothing to do with functions.php of the main theme which you should NEVER edit if you want to setup an independent child theme.
254,072
<p>I have successfully migrated wordpress site to my localhost using "All-in-One WP Migration" plugin.</p> <p>But I am getting errors on some pages:</p> <blockquote> <p>Parse error: syntax error, unexpected '}' in C:\xampp\apps\wordpress\htdocs\wp-content\themes\XXX\XXXXpage.php on line 112</p> </blockquote> <p>ed...
[ { "answer_id": 254047, "author": "Fabio Marzocca", "author_id": 65278, "author_profile": "https://wordpress.stackexchange.com/users/65278", "pm_score": 3, "selected": true, "text": "<p>I don't understand your target. If you want to create a child theme, it is quite easy and strightforwar...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254072", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111817/" ]
I have successfully migrated wordpress site to my localhost using "All-in-One WP Migration" plugin. But I am getting errors on some pages: > > Parse error: syntax error, unexpected '}' in C:\xampp\apps\wordpress\htdocs\wp-content\themes\XXX\XXXXpage.php on line 112 > > > editing that file, there is some hard-to-...
I don't understand your target. If you want to create a child theme, it is quite easy and strightforward; just follow these simple rules: <https://codex.wordpress.org/Child_Themes> Nothing to do with functions.php of the main theme which you should NEVER edit if you want to setup an independent child theme.
254,078
<p>I have a self hosted WordPress blog and I've just discovered that when clicking on page 2 or "next" with the navigation at the bottom of the main homepage (showing the latest posts) I get a 404.</p> <p>From what I can work out the URL isn't formed correctly for those buttons. It's doing:</p> <pre><code>https://exa...
[ { "answer_id": 254047, "author": "Fabio Marzocca", "author_id": 65278, "author_profile": "https://wordpress.stackexchange.com/users/65278", "pm_score": 3, "selected": true, "text": "<p>I don't understand your target. If you want to create a child theme, it is quite easy and strightforwar...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254078", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111825/" ]
I have a self hosted WordPress blog and I've just discovered that when clicking on page 2 or "next" with the navigation at the bottom of the main homepage (showing the latest posts) I get a 404. From what I can work out the URL isn't formed correctly for those buttons. It's doing: ``` https://example.com/adops/page/2...
I don't understand your target. If you want to create a child theme, it is quite easy and strightforward; just follow these simple rules: <https://codex.wordpress.org/Child_Themes> Nothing to do with functions.php of the main theme which you should NEVER edit if you want to setup an independent child theme.
254,084
<p>WordPress' TinyMCE (WYSIWYG) editor is adding inline stlyes to the markup when you change the text alignment. This behaviour is hard coded in <code>wp-includes/class-wp-editor.php</code>.</p> <p>Can the inline styles be changed to classes instead?</p>
[ { "answer_id": 265474, "author": "cjbj", "author_id": 75495, "author_profile": "https://wordpress.stackexchange.com/users/75495", "pm_score": 3, "selected": false, "text": "<p><strong>Note</strong> This answer was originally included in <a href=\"https://wordpress.stackexchange.com/users...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254084", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111830/" ]
WordPress' TinyMCE (WYSIWYG) editor is adding inline stlyes to the markup when you change the text alignment. This behaviour is hard coded in `wp-includes/class-wp-editor.php`. Can the inline styles be changed to classes instead?
**Note** This answer was originally included in [@bitstarr](https://wordpress.stackexchange.com/users/111830/bitstarr)'s question above and was included as a separate answer here to comply with WPSE's Q&A model. --- Maybe someone else will have this issue and so i will share my solution here with you folks. ``` func...
254,085
<p>Is it possible to use <code>register_rest_route()</code> with optional parameters in url?</p> <p>Let's say route is registered this way:</p> <pre><code>register_rest_route( 'api', '/animals/(?P&lt;id&gt;\d+)', [ 'methods' =&gt; WP_REST_Server::READABLE, 'callback' =&gt; 'get_animals', 'args' =&gt; [ ...
[ { "answer_id": 271306, "author": "jackreichert", "author_id": 2165, "author_profile": "https://wordpress.stackexchange.com/users/2165", "pm_score": 3, "selected": false, "text": "<p>There may be a way to do it with one <code>register_rest_route</code> function call, I do not know how to ...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254085", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/47861/" ]
Is it possible to use `register_rest_route()` with optional parameters in url? Let's say route is registered this way: ``` register_rest_route( 'api', '/animals/(?P<id>\d+)', [ 'methods' => WP_REST_Server::READABLE, 'callback' => 'get_animals', 'args' => [ 'id' ], ] ); ``` It's now possible to ...
You should put the named parameters of the route regex into an optional capturing group: ``` register_rest_route( 'api', '/animals(?:/(?P<id>\d+))?', [ 'methods' => WP_REST_Server::READABLE, 'callback' => 'get_animals', 'args' => [ 'id' ], ] ); ``` The second parameter is simply a regex, thus yo...
254,094
<p>I am trying to make installations easier on my Mac using MAMP by using WP-CLI.</p> <p>I made a simple .sh file:</p> <pre><code>wp core download wp core config --dbname=dbname --dbuser=root --dbpass=root wp db create wp core install --url="http://localhost:8888/folder" --title="name" --admin_user="admin" --admin_pa...
[ { "answer_id": 254285, "author": "user42826", "author_id": 42826, "author_profile": "https://wordpress.stackexchange.com/users/42826", "pm_score": 1, "selected": false, "text": "<p>The reason is because the cron script's environment has minimal configuration. When you as a user log into...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254094", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48745/" ]
I am trying to make installations easier on my Mac using MAMP by using WP-CLI. I made a simple .sh file: ``` wp core download wp core config --dbname=dbname --dbuser=root --dbpass=root wp db create wp core install --url="http://localhost:8888/folder" --title="name" --admin_user="admin" --admin_password="password" --a...
The reason is because the cron script's environment has minimal configuration. When you as a user log into your system, additional environment variable are set which allow you to execute programs without explicitly defining the full path. The best way to fix this is to define the full path to your program(s) in your c...
254,108
<p>I'm trying to build my first custom theme by watching some tutorials and tips. </p> <p>So I have the index, custom pages, and I tried to make the "archive" page and it redirects to my index. The file "archive.php" is there, and in the Reading Settings I requested that the "Blog" page (created in the Pages menu) rec...
[ { "answer_id": 254111, "author": "Al Rosado", "author_id": 84237, "author_profile": "https://wordpress.stackexchange.com/users/84237", "pm_score": 0, "selected": false, "text": "<p>You should use home.php file instead of index.php, this is the <a href=\"https://developer.wordpress.org/th...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254108", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111843/" ]
I'm trying to build my first custom theme by watching some tutorials and tips. So I have the index, custom pages, and I tried to make the "archive" page and it redirects to my index. The file "archive.php" is there, and in the Reading Settings I requested that the "Blog" page (created in the Pages menu) receive the p...
If you're using a static page as your front page (as shown in your first image), then neither archive.php or home.php will work. The page hierarchy for static home pages is: 1. Page Template 2. page-{slug}.php 3. page-{id}.php 4. page.php 5. index.php If you want to show an archive on your front page, select 'your la...
254,121
<p>A shortcode from a plugin I am trying to use is not working on my static front page, it only shows as plain shortcode text but It works well on all of my other pages. </p> <p>I'm using Illdy theme, I've already asked about this issue on their forum but I have a feeling that the issue is in my <code>front-page.php</...
[ { "answer_id": 254122, "author": "Dustin Snider", "author_id": 109640, "author_profile": "https://wordpress.stackexchange.com/users/109640", "pm_score": 3, "selected": true, "text": "<p>It looks like you need to change your front-page.php page, you are using the wrong variable.</p>\n\n<p...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254121", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111853/" ]
A shortcode from a plugin I am trying to use is not working on my static front page, it only shows as plain shortcode text but It works well on all of my other pages. I'm using Illdy theme, I've already asked about this issue on their forum but I have a feeling that the issue is in my `front-page.php` file. Is there ...
It looks like you need to change your front-page.php page, you are using the wrong variable. ``` $static_page_content = get_the_content(); ``` to ``` $static_page_content = the_content(); ``` Edit: I see you just updated your question to this, yes this will work fine. Shouldn't see any negative side effects from ...
254,160
<p>I need to create an Array that contains all of the children slugs of a specific parent category ID.</p> <p>Let's say I have the following parent category and its children categories:</p> <ol> <li>Food <ul> <li>pizza</li> <li>bread</li> <li>banana</li> <li>ice cream</li> </ul></li> </ol> <p>I need a code/function...
[ { "answer_id": 254162, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 2, "selected": true, "text": "<p>You can use <a href=\"https://developer.wordpress.org/reference/functions/get_terms/\" rel=\"nofollow norefe...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254160", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111876/" ]
I need to create an Array that contains all of the children slugs of a specific parent category ID. Let's say I have the following parent category and its children categories: 1. Food * pizza * bread * banana * ice cream I need a code/function to use inside `functions.php` that returns the slugs of all of the ch...
You can use [`get_terms()`](https://developer.wordpress.org/reference/functions/get_terms/) to get an array of child slugs: ``` /** * Get child term slugs from given term parent * * @param Integer $parent_id ( Parent Term ID ) * @param String $taxonomy ( Taxonomy Slug ) * * @return Array( $term_id => $child_slug...
254,163
<p>I’m trying to hide the menu page completely from this page:</p> <p><a href="http://ultimate-templates.com/splash-page" rel="nofollow noreferrer">http://ultimate-templates.com/splash-page</a></p> <p>I’m using Divi 3.0, and have tried – through online tutorials – to hide it using the following in my styles css sheet...
[ { "answer_id": 254164, "author": "A.T", "author_id": 111876, "author_profile": "https://wordpress.stackexchange.com/users/111876", "pm_score": -1, "selected": false, "text": "<p>Try this:</p>\n\n<p><code>.container.clearfix.et_menu_container {\n display: none;\n}</code></p>\n" }, ...
2017/01/26
[ "https://wordpress.stackexchange.com/questions/254163", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111884/" ]
I’m trying to hide the menu page completely from this page: <http://ultimate-templates.com/splash-page> I’m using Divi 3.0, and have tried – through online tutorials – to hide it using the following in my styles css sheet: ``` .page-id-27820 top-menu-nav { display: none important; } ``` That didn’t do anything, as...
Created a simple image for you on how to get page id and menu attributes. <https://dl.dropboxusercontent.com/s/zibhieyo3s6a5bs/Mailbird_2017-01-27_00-57-39.png> You need to get the page\_id, exactly as you did: ``` .page-id-27820 ``` and hide the menu, like so: ``` .page-id-27820 #top-menu-nav { display: none...
254,173
<pre><code>#container { width: 75%; float: right; } </code></pre> <p>If I change the width to %100 it affects the entire site, i just want the homepage to be at 100% width and all other pages with sidebar 75%</p>
[ { "answer_id": 254175, "author": "kidcoder", "author_id": 111846, "author_profile": "https://wordpress.stackexchange.com/users/111846", "pm_score": 0, "selected": false, "text": "<p>Give the div an id</p>\n\n<p><strong>HTML</strong></p>\n\n<pre><code>&lt;div id=\"whatever\"&gt; stuff in ...
2017/01/27
[ "https://wordpress.stackexchange.com/questions/254173", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111889/" ]
``` #container { width: 75%; float: right; } ``` If I change the width to %100 it affects the entire site, i just want the homepage to be at 100% width and all other pages with sidebar 75%
This is more a CSS than a WordPress question, but There are several ways to do this, but I think this is the easiest. WordPress themes should use the home class on the body tag and the site content area has a class of site-content, so to set the primary content area to full width, use: ``` .home .site-content { wi...
254,199
<pre><code>&lt;!-- query --&gt; &lt;?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $query = new WP_Query( array( 'category_name' =&gt; 'investor-news', 'posts_per_page' =&gt; 2, 'paged' =&gt; $paged ) ); ?&gt; &lt;?php if ( $query-&gt;have_posts() ) : ?&g...
[ { "answer_id": 254200, "author": "Dave Romsey", "author_id": 2807, "author_profile": "https://wordpress.stackexchange.com/users/2807", "pm_score": 7, "selected": true, "text": "<p>Replace <code>&lt;!-- WHAT GOES HERE?????? --&gt;</code> with the pagination code below:</p>\n<pre><code>&lt...
2017/01/27
[ "https://wordpress.stackexchange.com/questions/254199", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111846/" ]
``` <!-- query --> <?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $query = new WP_Query( array( 'category_name' => 'investor-news', 'posts_per_page' => 2, 'paged' => $paged ) ); ?> <?php if ( $query->have_posts() ) : ?> <!-- begin loop --> <?php while (...
Replace `<!-- WHAT GOES HERE?????? -->` with the pagination code below: ``` <div class="pagination"> <?php echo paginate_links( array( 'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ), 'total' => $query->max_num_pages, '...
254,257
<p>Within a span, the shortcode output works:</p> <pre><code>&lt;span&gt;[sola_testimonials_count type='all']&lt;/span&gt; Result: &lt;span&gt;5,205&lt;/span&gt; </code></pre> <p>But as an attribute value, it doesn't get parsed:</p> <pre><code>&lt;span data-value="[sola_testimonials_count type=\'all\']"&gt;&lt;/spa...
[ { "answer_id": 254208, "author": "Florian", "author_id": 111911, "author_profile": "https://wordpress.stackexchange.com/users/111911", "pm_score": 2, "selected": true, "text": "<ol>\n<li>Check this: Check this: <a href=\"https://premium.wpmudev.org/blog/daily-tip-how-to-automatically-set...
2017/01/27
[ "https://wordpress.stackexchange.com/questions/254257", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111220/" ]
Within a span, the shortcode output works: ``` <span>[sola_testimonials_count type='all']</span> Result: <span>5,205</span> ``` But as an attribute value, it doesn't get parsed: ``` <span data-value="[sola_testimonials_count type=\'all\']"></span> Result: <span data-value="[sola_testimonials_count type=\'all\']">...
1. Check this: Check this: <https://premium.wpmudev.org/blog/daily-tip-how-to-automatically-set-the-featured-image-in-wordpress/> 2. <http://dominiquej.com/how-to-delete-uncategorized-wordpress/> 3. No, 301 redirects will typically not impact your performance in the SERPs negatively when done correctly. 4. Please speci...
254,259
<p>I know similar questions have been asked, but none of them seem to answer the question.</p> <p>I've set up a post-loop widget that I put on the home page. It has pagination, but whenever going to any page other than the first, I get a nasty 404. The reason is because, when the URL gets a <code>/page/2/</code> or a ...
[ { "answer_id": 254270, "author": "Alexander Holsgrove", "author_id": 48962, "author_profile": "https://wordpress.stackexchange.com/users/48962", "pm_score": 1, "selected": false, "text": "<p>You will need to take the value of <code>/page/n</code> and pass it into your custom loop:</p>\n\...
2017/01/27
[ "https://wordpress.stackexchange.com/questions/254259", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80614/" ]
I know similar questions have been asked, but none of them seem to answer the question. I've set up a post-loop widget that I put on the home page. It has pagination, but whenever going to any page other than the first, I get a nasty 404. The reason is because, when the URL gets a `/page/2/` or a `/?page=2` in it, Wor...
After a bit of research and playing with it, I did get it to work. **Issue 1** The first trick (as mentioned above) was to switch the home page display to use "A static page." This eliminated the 404 issue, but didn't fix the pagination staying on page 1. **Issue 2** The second issue I fixed by getting the 'pag...
254,283
<p>I used this code in my child theme(child theme functions.php):</p> <pre><code> add_action( 'phpmailer_init', 'wpse8170_phpmailer_init',0 ); function wpse8170_phpmailer_init( PHPMailer $phpmailer ) { $phpmailer-&gt;Host = 'your.smtp.server.here'; $phpmailer-&gt;Port = 25; // could be different $phpmai...
[ { "answer_id": 254270, "author": "Alexander Holsgrove", "author_id": 48962, "author_profile": "https://wordpress.stackexchange.com/users/48962", "pm_score": 1, "selected": false, "text": "<p>You will need to take the value of <code>/page/n</code> and pass it into your custom loop:</p>\n\...
2017/01/28
[ "https://wordpress.stackexchange.com/questions/254283", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48767/" ]
I used this code in my child theme(child theme functions.php): ``` add_action( 'phpmailer_init', 'wpse8170_phpmailer_init',0 ); function wpse8170_phpmailer_init( PHPMailer $phpmailer ) { $phpmailer->Host = 'your.smtp.server.here'; $phpmailer->Port = 25; // could be different $phpmailer->Username = 'you...
After a bit of research and playing with it, I did get it to work. **Issue 1** The first trick (as mentioned above) was to switch the home page display to use "A static page." This eliminated the 404 issue, but didn't fix the pagination staying on page 1. **Issue 2** The second issue I fixed by getting the 'pag...
254,297
<p>I have seen many plugin installations require to add </p> <pre><code>&lt;?php do_action('plugin_name_hook'); ?&gt; </code></pre> <p>inside the templates files. What does it do?</p>
[ { "answer_id": 254270, "author": "Alexander Holsgrove", "author_id": 48962, "author_profile": "https://wordpress.stackexchange.com/users/48962", "pm_score": 1, "selected": false, "text": "<p>You will need to take the value of <code>/page/n</code> and pass it into your custom loop:</p>\n\...
2017/01/28
[ "https://wordpress.stackexchange.com/questions/254297", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111885/" ]
I have seen many plugin installations require to add ``` <?php do_action('plugin_name_hook'); ?> ``` inside the templates files. What does it do?
After a bit of research and playing with it, I did get it to work. **Issue 1** The first trick (as mentioned above) was to switch the home page display to use "A static page." This eliminated the 404 issue, but didn't fix the pagination staying on page 1. **Issue 2** The second issue I fixed by getting the 'pag...
254,310
<p>When I use the <code>wp_mail()</code> or <code>mail()</code> function in AJAX, the function doesn't work and doesn't send email.</p> <p>When I use these functions simply in my functions.php file it works fine.</p> <p>It's not related to WordPress functions or actions. I have checked everything, including using SMT...
[ { "answer_id": 254339, "author": "T.Todua", "author_id": 33667, "author_profile": "https://wordpress.stackexchange.com/users/33667", "pm_score": -1, "selected": false, "text": "<p>what is this? </p>\n\n<p><code>add_action( 'phpmailer_init', ...........</code> </p>\n\n<p>you should use:</...
2017/01/28
[ "https://wordpress.stackexchange.com/questions/254310", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48767/" ]
When I use the `wp_mail()` or `mail()` function in AJAX, the function doesn't work and doesn't send email. When I use these functions simply in my functions.php file it works fine. It's not related to WordPress functions or actions. I have checked everything, including using SMTP mail. SMTP mail works same as `mail()...
@T.Todua : Ok and when I use your way it doesn't deliver the email. It doesn't send email in Ajax function and it's my problem exactly ``` add_action( 'wp_ajax_ABCABCABC', 'wpse8170_phpmailer_init' ); function wpse8170_phpmailer_init() { //it doesn't send/deliver in a Ajax function wp_mail("hossein@mydomain.net", ...
254,317
<p>I am searching for a code or better a wordpress plugin to set automatically all links only to a certain domain (and of course to all of its subpages) to "nofollow". </p> <p>I could not find any plugin which is doing that, maybe you are knowing one or a coding-solution (javascript I guess).</p> <p>F.e. the plugins ...
[ { "answer_id": 254339, "author": "T.Todua", "author_id": 33667, "author_profile": "https://wordpress.stackexchange.com/users/33667", "pm_score": -1, "selected": false, "text": "<p>what is this? </p>\n\n<p><code>add_action( 'phpmailer_init', ...........</code> </p>\n\n<p>you should use:</...
2017/01/28
[ "https://wordpress.stackexchange.com/questions/254317", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111998/" ]
I am searching for a code or better a wordpress plugin to set automatically all links only to a certain domain (and of course to all of its subpages) to "nofollow". I could not find any plugin which is doing that, maybe you are knowing one or a coding-solution (javascript I guess). F.e. the plugins I found and their...
@T.Todua : Ok and when I use your way it doesn't deliver the email. It doesn't send email in Ajax function and it's my problem exactly ``` add_action( 'wp_ajax_ABCABCABC', 'wpse8170_phpmailer_init' ); function wpse8170_phpmailer_init() { //it doesn't send/deliver in a Ajax function wp_mail("hossein@mydomain.net", ...
254,319
<p>I have many almost identical pages on my web page for seo purposes, I would like to change rewrite an entire block of text to something else, is this possible to do in one go as it would take ages to do individually?</p> <p>many thanks Dave</p>
[ { "answer_id": 254339, "author": "T.Todua", "author_id": 33667, "author_profile": "https://wordpress.stackexchange.com/users/33667", "pm_score": -1, "selected": false, "text": "<p>what is this? </p>\n\n<p><code>add_action( 'phpmailer_init', ...........</code> </p>\n\n<p>you should use:</...
2017/01/28
[ "https://wordpress.stackexchange.com/questions/254319", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112000/" ]
I have many almost identical pages on my web page for seo purposes, I would like to change rewrite an entire block of text to something else, is this possible to do in one go as it would take ages to do individually? many thanks Dave
@T.Todua : Ok and when I use your way it doesn't deliver the email. It doesn't send email in Ajax function and it's my problem exactly ``` add_action( 'wp_ajax_ABCABCABC', 'wpse8170_phpmailer_init' ); function wpse8170_phpmailer_init() { //it doesn't send/deliver in a Ajax function wp_mail("hossein@mydomain.net", ...
254,321
<p>I want to add submenu to a navigation menu in wordPress through code (not through admin panel) and I am totally new to Wordpress. Any help would be greatly appreciated! Thanks!</p>
[ { "answer_id": 254322, "author": "Tom", "author_id": 51187, "author_profile": "https://wordpress.stackexchange.com/users/51187", "pm_score": 0, "selected": false, "text": "<p>Can you describe why you want to do it through code rather than the admin panel?</p>\n\n<p>Your answer might be f...
2017/01/28
[ "https://wordpress.stackexchange.com/questions/254321", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112001/" ]
I want to add submenu to a navigation menu in wordPress through code (not through admin panel) and I am totally new to Wordpress. Any help would be greatly appreciated! Thanks!
I got the answer, here it is: I want to add submenus ffrom database to the menu named 'Products' Create a custom plugin and install it through Admin panel. Inside the functions.php write this code. This is upgrade safe way and will not brake if the theme is updated. ``` add_filter( 'wp_nav_menu_objects', 'ravs_add_me...
254,328
<p>I have a question about reasons why the main query would call the current page's info when using a template file, instead of querying the posts. </p> <p>If I modify the loop by creating a custom query using <code>new WP_query</code>, I can access the all the posts on my custom template as I want. However, when I t...
[ { "answer_id": 254322, "author": "Tom", "author_id": 51187, "author_profile": "https://wordpress.stackexchange.com/users/51187", "pm_score": 0, "selected": false, "text": "<p>Can you describe why you want to do it through code rather than the admin panel?</p>\n\n<p>Your answer might be f...
2017/01/28
[ "https://wordpress.stackexchange.com/questions/254328", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105196/" ]
I have a question about reasons why the main query would call the current page's info when using a template file, instead of querying the posts. If I modify the loop by creating a custom query using `new WP_query`, I can access the all the posts on my custom template as I want. However, when I try use the main loop/q...
I got the answer, here it is: I want to add submenus ffrom database to the menu named 'Products' Create a custom plugin and install it through Admin panel. Inside the functions.php write this code. This is upgrade safe way and will not brake if the theme is updated. ``` add_filter( 'wp_nav_menu_objects', 'ravs_add_me...
254,334
<p>I added this to my functions.php to restrict non-admin access to wp-admin by redirecting the non-admin to the home page. However, this does not work for users who aren't users (users who are not logged in).</p> <p>How can I include visitors who are not users in this script?</p> <pre><code>/** * Restrict access to...
[ { "answer_id": 254322, "author": "Tom", "author_id": 51187, "author_profile": "https://wordpress.stackexchange.com/users/51187", "pm_score": 0, "selected": false, "text": "<p>Can you describe why you want to do it through code rather than the admin panel?</p>\n\n<p>Your answer might be f...
2017/01/28
[ "https://wordpress.stackexchange.com/questions/254334", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111846/" ]
I added this to my functions.php to restrict non-admin access to wp-admin by redirecting the non-admin to the home page. However, this does not work for users who aren't users (users who are not logged in). How can I include visitors who are not users in this script? ``` /** * Restrict access to the administration s...
I got the answer, here it is: I want to add submenus ffrom database to the menu named 'Products' Create a custom plugin and install it through Admin panel. Inside the functions.php write this code. This is upgrade safe way and will not brake if the theme is updated. ``` add_filter( 'wp_nav_menu_objects', 'ravs_add_me...
254,351
<pre><code>sudo vim /var/www/html/wp/wp-config.php define('ALLOW_UNFILTERED_UPLOADS', true); </code></pre> <p>I have add the line in wp-config.php. <a href="https://i.stack.imgur.com/cbktk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cbktk.png" alt="enter image description here"></a></p> <p>wh...
[ { "answer_id": 254352, "author": "hcheung", "author_id": 111577, "author_profile": "https://wordpress.stackexchange.com/users/111577", "pm_score": 0, "selected": false, "text": "<p>I think the error message speak for itself. The \"file type is not allowed\". WordPress upload only allowed...
2017/01/29
[ "https://wordpress.stackexchange.com/questions/254351", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/70405/" ]
``` sudo vim /var/www/html/wp/wp-config.php define('ALLOW_UNFILTERED_UPLOADS', true); ``` I have add the line in wp-config.php. [![enter image description here](https://i.stack.imgur.com/cbktk.png)](https://i.stack.imgur.com/cbktk.png) why still can't upload deb package whose size is only 5m in my wordpress? [![e...
I think the error message speak for itself. The "file type is not allowed". WordPress upload only allowed for certain file types, see [Uploading Files](https://codex.wordpress.org/Uploading_Files).
254,355
<p>I want to use the <code>the_title()</code> function to get the title of a post and then reference that title in an array. Code is as follows:</p> <pre><code> &lt;?php $title = array( the_title() ); $args = array( 'post_type' =&gt; array( 'quest...
[ { "answer_id": 254352, "author": "hcheung", "author_id": 111577, "author_profile": "https://wordpress.stackexchange.com/users/111577", "pm_score": 0, "selected": false, "text": "<p>I think the error message speak for itself. The \"file type is not allowed\". WordPress upload only allowed...
2017/01/29
[ "https://wordpress.stackexchange.com/questions/254355", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112022/" ]
I want to use the `the_title()` function to get the title of a post and then reference that title in an array. Code is as follows: ``` <?php $title = array( the_title() ); $args = array( 'post_type' => array( 'questions' ), 'content' => array( $t...
I think the error message speak for itself. The "file type is not allowed". WordPress upload only allowed for certain file types, see [Uploading Files](https://codex.wordpress.org/Uploading_Files).
254,389
<p>I'm trying to enqueue comment-reply.js script only on a certain page but something is wrong with my code. Can someone hint things here?</p> <pre><code>&lt;?php if ( is_singular('1740') &amp;&amp; (!is_home() || !is_front_page() || !is_single()) &amp;&amp; comments_open() &amp;&amp; get_option('thread_comments') ) w...
[ { "answer_id": 254442, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>I've sometimes struggled with the proper placement of plugins folder structure in Subversion. The proc...
2017/01/29
[ "https://wordpress.stackexchange.com/questions/254389", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18693/" ]
I'm trying to enqueue comment-reply.js script only on a certain page but something is wrong with my code. Can someone hint things here? ``` <?php if ( is_singular('1740') && (!is_home() || !is_front_page() || !is_single()) && comments_open() && get_option('thread_comments') ) wp_enqueue_script( 'comment-reply' ); ?> ...
The WordPress plugin repository always starts with what is in trunk. It reads down to the "Stable Tag" label. If the stable tag is "trunk" it continues reading from trunk. This is what people who download your plugin will get. If, however, the stable tag label is a tag (in this case, 1.0.7), it quits reading trunk and...
254,393
<p>I am modifying my main queries with a function, <code>modify_main_query($query)</code>, that determines which page is being accessed by the user via if/else statement, and then modifies the query accordingly. I am adding that function using this hook:</p> <h3>The main function's hook</h3> <p><code>add_action('pre_g...
[ { "answer_id": 254406, "author": "prosti", "author_id": 88606, "author_profile": "https://wordpress.stackexchange.com/users/88606", "pm_score": 3, "selected": true, "text": "<p>This looks good. If we assume <code>get_exclusion_IDs_for_cats_by_name($cat_names);</code> works correct then y...
2017/01/29
[ "https://wordpress.stackexchange.com/questions/254393", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105196/" ]
I am modifying my main queries with a function, `modify_main_query($query)`, that determines which page is being accessed by the user via if/else statement, and then modifies the query accordingly. I am adding that function using this hook: ### The main function's hook `add_action('pre_get_posts', 'modify_main_query'...
This looks good. If we assume `get_exclusion_IDs_for_cats_by_name($cat_names);` works correct then you are doing it right. Your question may be rephrased like this: > > Can I call other functions inside the custom actions? > > > And the answer is **yes**. The only thing you need to be careful is that your othe...
254,394
<p>I just added a new page which needed some javascript to pull json(with setInterval) and display content in that page div tag, On digging i discovered we can add script tag in themes/header.php file . </p> <p>but that means it would load with all the pages or blog maybe, but I just want the javascript to load for th...
[ { "answer_id": 254406, "author": "prosti", "author_id": 88606, "author_profile": "https://wordpress.stackexchange.com/users/88606", "pm_score": 3, "selected": true, "text": "<p>This looks good. If we assume <code>get_exclusion_IDs_for_cats_by_name($cat_names);</code> works correct then y...
2017/01/29
[ "https://wordpress.stackexchange.com/questions/254394", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/102804/" ]
I just added a new page which needed some javascript to pull json(with setInterval) and display content in that page div tag, On digging i discovered we can add script tag in themes/header.php file . but that means it would load with all the pages or blog maybe, but I just want the javascript to load for that specifi...
This looks good. If we assume `get_exclusion_IDs_for_cats_by_name($cat_names);` works correct then you are doing it right. Your question may be rephrased like this: > > Can I call other functions inside the custom actions? > > > And the answer is **yes**. The only thing you need to be careful is that your othe...
254,397
<p>I want load some scripts and style only for a specific shortcode. I used</p> <pre><code>if ( is_a( $post, 'WP_Post' ) &amp;&amp; has_shortcode( $post-&gt;post_content, 'my_shortcode') ) {} </code></pre> <p>It works when I put my shortcode on page but it does not work when I put my shortcode in page template. Like ...
[ { "answer_id": 254419, "author": "Nathan Johnson", "author_id": 106269, "author_profile": "https://wordpress.stackexchange.com/users/106269", "pm_score": 1, "selected": false, "text": "<p>Add a filter to <code>pre_do_shortcode_tag</code> and check if $tag is the same as your shortcode ta...
2017/01/29
[ "https://wordpress.stackexchange.com/questions/254397", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51110/" ]
I want load some scripts and style only for a specific shortcode. I used ``` if ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'my_shortcode') ) {} ``` It works when I put my shortcode on page but it does not work when I put my shortcode in page template. Like the following one in **index.php** fi...
Add a filter to `pre_do_shortcode_tag` and check if $tag is the same as your shortcode tag. If it is, enqueue a script in the footer. ``` add_filter( 'pre_do_shortcode_tag', function( $a, $tag, $attr, $m ) { if( 'my_shortcode_tag' === $tag ) { wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer = true ); ...
254,398
<p>I'm Starting a WordPress website and I'm having a problem with some of my posts.</p> <p>This issue is only affecting 2 out of 4 articles and after investigating I cannot think on a reason for that.</p> <p>This error message appears right below comments section:</p> <blockquote> <p>Notice: Undefined offset: 0 in...
[ { "answer_id": 254400, "author": "markratledge", "author_id": 268, "author_profile": "https://wordpress.stackexchange.com/users/268", "pm_score": 3, "selected": true, "text": "<p>You're looking in WordPress core files for the cause of the PHP notice, which is a waste of time, as 1) I dou...
2017/01/29
[ "https://wordpress.stackexchange.com/questions/254398", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111992/" ]
I'm Starting a WordPress website and I'm having a problem with some of my posts. This issue is only affecting 2 out of 4 articles and after investigating I cannot think on a reason for that. This error message appears right below comments section: > > Notice: Undefined offset: 0 in > /home/\*\*\*/public\_html/wp-i...
You're looking in WordPress core files for the cause of the PHP notice, which is a waste of time, as 1) I doubt you've found a new bug in WordPress, and 2) you don't want to modify WordPress core files to fix a theme or plugin issue, and 3) the error is caused by a theme or plugin and not WordPress core, but shows up i...
254,506
<p>I have simple coding problem and I'm hoping someone to help me out.</p> <p>I have created a custom filed with CFS and I called it tracking_url It holds a URL value eg. google.com/?tracking123423423....</p> <p>Filed type I set to: hyperlink in the back-end of wordpress.</p> <p>On the front-end I want to create a b...
[ { "answer_id": 371822, "author": "dylzee", "author_id": 190737, "author_profile": "https://wordpress.stackexchange.com/users/190737", "pm_score": 1, "selected": false, "text": "<p>This might be a conflict/issue with your theme. What theme are you using? Have you checked any comment or tr...
2017/01/30
[ "https://wordpress.stackexchange.com/questions/254506", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112031/" ]
I have simple coding problem and I'm hoping someone to help me out. I have created a custom filed with CFS and I called it tracking\_url It holds a URL value eg. google.com/?tracking123423423.... Filed type I set to: hyperlink in the back-end of wordpress. On the front-end I want to create a button with href the val...
Try to check on DB level. This SQL should give a list of all spam comments (which I assume skräpposter means): `SELECT * FROM `wp_comments` WHERE `comment_approved` = 'spam';` If the SQL gives 0 lines, the issue is with WordPress counting those comments, but in fact there are none. If the SQL gives a list, the issue...
254,513
<p>Wordpress is creating a &amp;nbsp in the_excerpt. How do I remove it?</p> <pre><code>&lt;div class="subtitulo-noticia"&gt;&lt;?php the_excerpt(); ?&gt;&lt;/div&gt; </code></pre> <p><a href="https://i.stack.imgur.com/YH1Op.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YH1Op.png" alt="enter imag...
[ { "answer_id": 254514, "author": "mrben522", "author_id": 84703, "author_profile": "https://wordpress.stackexchange.com/users/84703", "pm_score": 1, "selected": false, "text": "<p>If you can't get rid of the extra space in the admin, then use trim()</p>\n\n<pre><code>&lt;div class=\"subt...
2017/01/30
[ "https://wordpress.stackexchange.com/questions/254513", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111513/" ]
Wordpress is creating a &nbsp in the\_excerpt. How do I remove it? ``` <div class="subtitulo-noticia"><?php the_excerpt(); ?></div> ``` [![enter image description here](https://i.stack.imgur.com/YH1Op.png)](https://i.stack.imgur.com/YH1Op.png) &nbsp creates a space at the beginning of p [![enter image description ...
I'm not sure why there's a non-breaking space being added to the front of your excerpt. It would be best to find out what is putting that there. But in the meantime, you can add this to your theme functions.php ( or a simple plugin ) and it should take care of it. ``` //* Remove non-breaking space from beginning of pa...
254,523
<p>I have the following setup:</p> <ul> <li>3 posts: <code>post1</code>, <code>post2</code>, &amp; <code>post3</code></li> <li>2 categories: <code>cat1</code> &amp; <code>cat2</code></li> <li>2 templates: <code>singe1.php</code> &amp; <code>single2.php</code></li> </ul> <p><strong></strong></p> <ul> <li><code>post1<...
[ { "answer_id": 254529, "author": "Pat J", "author_id": 16121, "author_profile": "https://wordpress.stackexchange.com/users/16121", "pm_score": 0, "selected": false, "text": "<p>You can use the <a href=\"https://developer.wordpress.org/themes/basics/template-hierarchy/\" rel=\"nofollow no...
2017/01/30
[ "https://wordpress.stackexchange.com/questions/254523", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112113/" ]
I have the following setup: * 3 posts: `post1`, `post2`, & `post3` * 2 categories: `cat1` & `cat2` * 2 templates: `singe1.php` & `single2.php` * `post1` and `post2` are assigned to `cat1` * `post3` is assigned to `cat2` `post1` and `post2` should use `template1` and `post3` should use `template2` I have found this ...
nikolaou, When I understand you question correct then you want to use different templates based on the categories you're using within your posts, correct? If that's the case, then you only need one template (single.php) and a combination of `get_the_terms()` and `get_template_part()`. ``` <?php $categories = get_t...
254,626
<p>Future home of something quite cool. If you're the site owner, log in to launch this site</p> <p>If you are a visitor, check back soon." </p>
[ { "answer_id": 254642, "author": "TheGcool", "author_id": 112168, "author_profile": "https://wordpress.stackexchange.com/users/112168", "pm_score": 0, "selected": false, "text": "<p>If you have full control to Your website cpanel then you can change your worpress site url to https from h...
2017/01/31
[ "https://wordpress.stackexchange.com/questions/254626", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112193/" ]
Future home of something quite cool. If you're the site owner, log in to launch this site If you are a visitor, check back soon."
If you don't have access to your cPanel, or don't know how to make a database change, you can instead add these 2 lines to your wp-config.php file: ``` define( 'WP_SITEURL', 'http://example.com/' ); define( 'WP_HOME', 'http://example.com/' ); ``` You'll of course want to change the urls to your actual urls. Just mak...
254,628
<p>Can I add a button on the menu bar that take the user to another website with the same current path? </p> <p>For example, I am in the page with url:</p> <pre><code>www.example.com/test/blank </code></pre> <p>And when press the button it takes me to the url:</p> <pre><code>www.example.com **/ar** /test/blank </co...
[ { "answer_id": 254642, "author": "TheGcool", "author_id": 112168, "author_profile": "https://wordpress.stackexchange.com/users/112168", "pm_score": 0, "selected": false, "text": "<p>If you have full control to Your website cpanel then you can change your worpress site url to https from h...
2017/01/31
[ "https://wordpress.stackexchange.com/questions/254628", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112194/" ]
Can I add a button on the menu bar that take the user to another website with the same current path? For example, I am in the page with url: ``` www.example.com/test/blank ``` And when press the button it takes me to the url: ``` www.example.com **/ar** /test/blank ```
If you don't have access to your cPanel, or don't know how to make a database change, you can instead add these 2 lines to your wp-config.php file: ``` define( 'WP_SITEURL', 'http://example.com/' ); define( 'WP_HOME', 'http://example.com/' ); ``` You'll of course want to change the urls to your actual urls. Just mak...
254,636
<p>I've created (as part of a theme) a few metaboxes for my post type. The metaboxes allow the user to interact with different instances of tinyMCE. Everything is working as it should, however, I can't for the life of me figure out which hook to use for publishing a post that is missing a title/content.</p> <p>I've ha...
[ { "answer_id": 254639, "author": "TheGcool", "author_id": 112168, "author_profile": "https://wordpress.stackexchange.com/users/112168", "pm_score": 0, "selected": false, "text": "<p>If you click publish without title of your post. It will get published.This might not help you what you're...
2017/01/31
[ "https://wordpress.stackexchange.com/questions/254636", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54053/" ]
I've created (as part of a theme) a few metaboxes for my post type. The metaboxes allow the user to interact with different instances of tinyMCE. Everything is working as it should, however, I can't for the life of me figure out which hook to use for publishing a post that is missing a title/content. I've had a look a...
Ever since the [solution mentioned here](https://wordpress.stackexchange.com/questions/28021/how-to-publish-a-post-with-empty-title-and-empty-content), WP has been updated and now allows you to manipulate the save process of [`wp_insert_post`](https://developer.wordpress.org/reference/functions/wp_insert_post/). If you...
254,652
<p>Someone modifying daily our website file <code>wp-blog-header.php</code>.</p> <p>They are adding below code which generates unneceassy pages automatic in our website, Code is :</p> <pre><code>$e = pathinfo($f = strtok($p = @$_SERVER["REQUEST_URI"], "?"), PATHINFO_EXTENSION); if ((!$e || in_array($e, array("html",...
[ { "answer_id": 254653, "author": "Greg Burkett", "author_id": 103916, "author_profile": "https://wordpress.stackexchange.com/users/103916", "pm_score": 2, "selected": false, "text": "<p>The problem is bigger than your attempted solution. If you block that file from being edited, then the...
2017/01/31
[ "https://wordpress.stackexchange.com/questions/254652", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/63730/" ]
Someone modifying daily our website file `wp-blog-header.php`. They are adding below code which generates unneceassy pages automatic in our website, Code is : ``` $e = pathinfo($f = strtok($p = @$_SERVER["REQUEST_URI"], "?"), PATHINFO_EXTENSION); if ((!$e || in_array($e, array("html", "jpg", "png", "gif")) || ba...
The problem is bigger than your attempted solution. If you block that file from being edited, then they can simply just try editing a different file. Someone has obviously hacked your hosting account via weak FTP password, a plugin vulnerability, outdated code, etc. You should focus on closing however they're gaining ...
254,657
<p>Is there a way to filter Wordpress save_post in a way that if more than one category is present, the Uncategorized category is unset/removed? This should works also on first post save</p>
[ { "answer_id": 254691, "author": "Shibi", "author_id": 62500, "author_profile": "https://wordpress.stackexchange.com/users/62500", "pm_score": 4, "selected": true, "text": "<p>Yes. You can use the save_post action and do it here is some function that remove the default wordpress category...
2017/01/31
[ "https://wordpress.stackexchange.com/questions/254657", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1210/" ]
Is there a way to filter Wordpress save\_post in a way that if more than one category is present, the Uncategorized category is unset/removed? This should works also on first post save
Yes. You can use the save\_post action and do it here is some function that remove the default wordpress category if there is some other category selected. I added some comments so you will understand the process. ``` function remove_uncategorized($post_id) { // get default category $default_category = (int)g...
254,676
<p>I have this code in <code>author.php</code> file</p> <pre><code>echo $part_cur_auth_obj-&gt;description; </code></pre> <p>How can i parse the echo so the links within the author description will have the <code>rel="nofollow"</code> attribute set automatically?</p>
[ { "answer_id": 254679, "author": "Arsalan Mithani", "author_id": 111402, "author_profile": "https://wordpress.stackexchange.com/users/111402", "pm_score": 0, "selected": false, "text": "<p>You can do this simply by javascript code, Add this to your <code>footer.php</code> file this will ...
2017/01/31
[ "https://wordpress.stackexchange.com/questions/254676", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103331/" ]
I have this code in `author.php` file ``` echo $part_cur_auth_obj->description; ``` How can i parse the echo so the links within the author description will have the `rel="nofollow"` attribute set automatically?
If you want to add rel="nofollow" to all the links, then you can simply use str\_replace(): ``` echo str_replace( '<a href=', '<a rel="nofollow" href=', $part_cur_auth_obj->description ); ```
254,721
<p>I'm using WordPress Version 4.7.2</p> <p>I'm trying to set up the new post page (wp-admin/post-new.php) so it automatically displays two custom fields. I'd like the custom field "name" pre-populated and the custom field "value" left blank. </p> <p><strong>Current New Post Page</strong></p> <p><a href="https://i.s...
[ { "answer_id": 254724, "author": "Sumesh S", "author_id": 104736, "author_profile": "https://wordpress.stackexchange.com/users/104736", "pm_score": 1, "selected": false, "text": "<p>The below code will add default custom fields to your post ( Insert the code in your themes function.php )...
2017/02/01
[ "https://wordpress.stackexchange.com/questions/254721", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64181/" ]
I'm using WordPress Version 4.7.2 I'm trying to set up the new post page (wp-admin/post-new.php) so it automatically displays two custom fields. I'd like the custom field "name" pre-populated and the custom field "value" left blank. **Current New Post Page** [![enter image description here](https://i.stack.imgur.co...
The below code will add default custom fields to your post ( Insert the code in your themes function.php ) . ``` add_action('wp_insert_post', 'set_default_custom_fields'); function set_default_custom_fields($post_id){ if ( $_GET['post_type'] == 'post' ) { add_post_meta($post_id, 'Field Name', '', true); add_post_meta...
254,735
<p>I'm using postMessage for my customizer and trying to avoid repetitions in customizer.php and customizer.js How can I use the variable $css from customizer.php and include it in customizer.js to avoid repeating h1,h2,h3 etc. So right now it works like this:</p> <p><strong>customizer.php code</strong></p> <pre><cod...
[ { "answer_id": 254943, "author": "Weston Ruter", "author_id": 8521, "author_profile": "https://wordpress.stackexchange.com/users/8521", "pm_score": 1, "selected": false, "text": "<p>Use <code>wp_add_inline_script()</code> to export the variable from PHP to JS. For example, in <code>my_st...
2017/02/01
[ "https://wordpress.stackexchange.com/questions/254735", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112255/" ]
I'm using postMessage for my customizer and trying to avoid repetitions in customizer.php and customizer.js How can I use the variable $css from customizer.php and include it in customizer.js to avoid repeating h1,h2,h3 etc. So right now it works like this: **customizer.php code** ``` function my_styles_method() { ...
Well, I finally made it working. I simply forgot to add\_inline\_style. Great thanks to Weston Ruter for help. So the final code is: ``` function my_styles_method() { wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/custom-css.css' ); $colors = array( 'headings_color' => get_th...
254,753
<p>I'm trying to set shipping rule in woocommerce. My conditions are as follows.</p> <ol> <li>$25 for selected postal codes; if total cart value is &lt; $250</li> <li>$0 / Free for same selected postal codes; if total cart value is >= $250</li> <li>Flat $25 for another set of postal codes (let's say Zone B)</li> <li>G...
[ { "answer_id": 254943, "author": "Weston Ruter", "author_id": 8521, "author_profile": "https://wordpress.stackexchange.com/users/8521", "pm_score": 1, "selected": false, "text": "<p>Use <code>wp_add_inline_script()</code> to export the variable from PHP to JS. For example, in <code>my_st...
2017/02/01
[ "https://wordpress.stackexchange.com/questions/254753", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110899/" ]
I'm trying to set shipping rule in woocommerce. My conditions are as follows. 1. $25 for selected postal codes; if total cart value is < $250 2. $0 / Free for same selected postal codes; if total cart value is >= $250 3. Flat $25 for another set of postal codes (let's say Zone B) 4. Generic message to call; if shippin...
Well, I finally made it working. I simply forgot to add\_inline\_style. Great thanks to Weston Ruter for help. So the final code is: ``` function my_styles_method() { wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/custom-css.css' ); $colors = array( 'headings_color' => get_th...
254,764
<p>I have set up a theme with a width of 964 px, so that images in the post should be shown as 964 px, when set to 100% (or 964 px). I mean the complete width of the page/wrapper.</p> <p>Unfortunately, this does not work, but I can not find the culprit.</p> <p>Link: <a href="http://bit.do/c8q8u" rel="nofollow norefer...
[ { "answer_id": 254765, "author": "Arsalan Mithani", "author_id": 111402, "author_profile": "https://wordpress.stackexchange.com/users/111402", "pm_score": 1, "selected": false, "text": "<p>in your class : <code>.post .post-excerpt img</code> add <code>width</code> instead of <code>max-wi...
2017/02/01
[ "https://wordpress.stackexchange.com/questions/254764", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50311/" ]
I have set up a theme with a width of 964 px, so that images in the post should be shown as 964 px, when set to 100% (or 964 px). I mean the complete width of the page/wrapper. Unfortunately, this does not work, but I can not find the culprit. Link: <http://bit.do/c8q8u> Code, I used: ``` html: <img src=".../x.jpg...
I found the problem. The content width was forced in functions.php: ``` ... if ( ! isset( $content_width ) ) $content_width = 634; add_theme_support( 'automatic-feed-links' ); ... ``` I changed the value to 964 and it works like it should. :)
254,776
<p>I've created a static site for a business code in plain HTML and CSS. Along the way, I've added in two WordPress installs in subdirectories, one being a blog page and another being an eCommerce site. </p> <p>Now that the website has begun to grow, the client suggested making the main static site part of WordPress. ...
[ { "answer_id": 254765, "author": "Arsalan Mithani", "author_id": 111402, "author_profile": "https://wordpress.stackexchange.com/users/111402", "pm_score": 1, "selected": false, "text": "<p>in your class : <code>.post .post-excerpt img</code> add <code>width</code> instead of <code>max-wi...
2017/02/01
[ "https://wordpress.stackexchange.com/questions/254776", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112286/" ]
I've created a static site for a business code in plain HTML and CSS. Along the way, I've added in two WordPress installs in subdirectories, one being a blog page and another being an eCommerce site. Now that the website has begun to grow, the client suggested making the main static site part of WordPress. Now I am m...
I found the problem. The content width was forced in functions.php: ``` ... if ( ! isset( $content_width ) ) $content_width = 634; add_theme_support( 'automatic-feed-links' ); ... ``` I changed the value to 964 and it works like it should. :)
254,784
<p>Need to update 1,000+ images which have French characters in them.</p> <p>The following worked for a test post:</p> <blockquote> <ul> <li>Created a copy of the image without the FR characters</li> <li>Updated file name inside the blog post's body using <strong>wp_update_post</strong> (WP function)</li> <li...
[ { "answer_id": 254765, "author": "Arsalan Mithani", "author_id": 111402, "author_profile": "https://wordpress.stackexchange.com/users/111402", "pm_score": 1, "selected": false, "text": "<p>in your class : <code>.post .post-excerpt img</code> add <code>width</code> instead of <code>max-wi...
2017/02/01
[ "https://wordpress.stackexchange.com/questions/254784", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88398/" ]
Need to update 1,000+ images which have French characters in them. The following worked for a test post: > > * Created a copy of the image without the FR characters > * Updated file name inside the blog post's body using **wp\_update\_post** (WP function) > * Updated 'attachment meta data' using **wp\_update\_attach...
I found the problem. The content width was forced in functions.php: ``` ... if ( ! isset( $content_width ) ) $content_width = 634; add_theme_support( 'automatic-feed-links' ); ... ``` I changed the value to 964 and it works like it should. :)
254,808
<p>I have a database table in WordPress as in the following example:</p> <pre>ID | Allocation_number | Treatment | Used 1 | 1 | A | 0 2 | 2 | B | 0 3 | 3 | B | 0 4 | 4 | A | 0</pre> <p>And the rows continues upto X times. The "Allocation_number" starts from 1 and increases by +1. "Used" column has "0" or "1", 0 indi...
[ { "answer_id": 254816, "author": "nibnut", "author_id": 111316, "author_profile": "https://wordpress.stackexchange.com/users/111316", "pm_score": 1, "selected": false, "text": "<p>So what you want is to use MySQL's \"ORDER BY\" feature:</p>\n\n<pre><code>SELECT Treatment FROM my_table WH...
2017/02/01
[ "https://wordpress.stackexchange.com/questions/254808", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112303/" ]
I have a database table in WordPress as in the following example: ``` ID | Allocation_number | Treatment | Used 1 | 1 | A | 0 2 | 2 | B | 0 3 | 3 | B | 0 4 | 4 | A | 0 ``` And the rows continues upto X times. The "Allocation\_number" starts from 1 and increases by +1. "Used" column has "0" or "1", 0 indicating NOT U...
So what you want is to use MySQL's "ORDER BY" feature: ``` SELECT Treatment FROM my_table WHERE Used=0 ORDER BY Allocation_number ASC LIMIT 1 ``` So you look for all rows where Used=0, order (sort) them by Allocation\_number in ascending order, and then pick the first row that matches. ("LIMIT 1") I'll let you plug...
254,845
<p>I have a custom post type called funerals and a page the lists all the posts part of that custom post type. To display a single page I create a file called single-funerals.php and that all works well. But, now I need to have another single post page that only displays a video for a funeral. How would I set that u...
[ { "answer_id": 254846, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>You could turn the single-funerals.php code into a 'page template', then use that template when you cr...
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254845", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5416/" ]
I have a custom post type called funerals and a page the lists all the posts part of that custom post type. To display a single page I create a file called single-funerals.php and that all works well. But, now I need to have another single post page that only displays a video for a funeral. How would I set that up and ...
As I answered [here](https://wordpress.stackexchange.com/questions/254772/how-to-add-page-attribute-template-to-custom-post/254781#254781), since WordPress 4.7 Post-Type-Templates are enabled in the WordPress core. That means that you can create multiple templates for the single post-type view. You create these templa...
254,850
<p>I'm trying to display the child pages of a parent page, this is working. But when I tried to exclude the current page in the list where the child pages displayed, it's not working.</p> <p>How to fix this?</p> <pre><code>$current_post_id = $post-&gt;ID; if(wp_list_pages("title_li=&amp;child_of=2143&amp;exclude='.$c...
[ { "answer_id": 254846, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>You could turn the single-funerals.php code into a 'page template', then use that template when you cr...
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254850", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103182/" ]
I'm trying to display the child pages of a parent page, this is working. But when I tried to exclude the current page in the list where the child pages displayed, it's not working. How to fix this? ``` $current_post_id = $post->ID; if(wp_list_pages("title_li=&child_of=2143&exclude='.$current_post_id.'")): if($tit...
As I answered [here](https://wordpress.stackexchange.com/questions/254772/how-to-add-page-attribute-template-to-custom-post/254781#254781), since WordPress 4.7 Post-Type-Templates are enabled in the WordPress core. That means that you can create multiple templates for the single post-type view. You create these templa...
254,872
<p>I've setup all permissions and directories/files correctly according to Wordpress. Adding plugins/installing/updating works perfectly, but when it comes to updating to 4.7.2, it asks me for FTP details or if I force FileSystem (direct) in the WP config file, it says it couldn't update due to inconsistent file permis...
[ { "answer_id": 254846, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>You could turn the single-funerals.php code into a 'page template', then use that template when you cr...
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254872", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/107924/" ]
I've setup all permissions and directories/files correctly according to Wordpress. Adding plugins/installing/updating works perfectly, but when it comes to updating to 4.7.2, it asks me for FTP details or if I force FileSystem (direct) in the WP config file, it says it couldn't update due to inconsistent file permissio...
As I answered [here](https://wordpress.stackexchange.com/questions/254772/how-to-add-page-attribute-template-to-custom-post/254781#254781), since WordPress 4.7 Post-Type-Templates are enabled in the WordPress core. That means that you can create multiple templates for the single post-type view. You create these templa...
254,876
<p>I would like users of my theme to be able to mark some posts as more important so that my theme can draw more attention to them. I'm not sure about the best way to go about this? Is it possible to add a default category of 'featured' to a theme that will be there as an option when anybody installs my theme? </p> <...
[ { "answer_id": 254882, "author": "Twentyonehundred", "author_id": 112349, "author_profile": "https://wordpress.stackexchange.com/users/112349", "pm_score": 1, "selected": false, "text": "<p>You can do this in a number of ways, using categories, tags, plugins or ACF fields.</p>\n\n<p>To u...
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254876", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81978/" ]
I would like users of my theme to be able to mark some posts as more important so that my theme can draw more attention to them. I'm not sure about the best way to go about this? Is it possible to add a default category of 'featured' to a theme that will be there as an option when anybody installs my theme? edit: Ta...
WordPress by default provides such feature named "Sticky Posts". you can mark any post as sticky from "Quick Edit" link. and WordPress will add a post class named `sticky` with all sticky posts. so you can use this class in your CSS for giving custom styles. and another solutions is to create custom post meta and met...
254,945
<p>I want to get Terms by IDs with IDs order. But that doesn't working, WP automatically change the order.</p> <p>My code-</p> <pre><code>$catsArray = array(159, 155, 143, 153, ......); $series = get_terms( array( 'taxonomy' =&gt; 'ctc_sermon_series', 'number' =&gt; 9, 'off...
[ { "answer_id": 254956, "author": "Anwer AR", "author_id": 83820, "author_profile": "https://wordpress.stackexchange.com/users/83820", "pm_score": 1, "selected": false, "text": "<p>This might work for you thought i've not tested.</p>\n\n<pre><code>$catsArray = array(159, 155, 143, 153, .....
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254945", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110431/" ]
I want to get Terms by IDs with IDs order. But that doesn't working, WP automatically change the order. My code- ``` $catsArray = array(159, 155, 143, 153, ......); $series = get_terms( array( 'taxonomy' => 'ctc_sermon_series', 'number' => 9, 'offset' => $offset, ...
So I believe the question is how to get the terms back in the order of the Ids you've provided - which might not be sorted ascending or descending, but a random order instead. Surprisingly, I think there's a shortcut for that in WP - who knew? This, I believe, is what you want to use: ``` $catsArray = array(159, 155,...
254,946
<p>I created the tag.php page and when I click on a tag on the page of a post it takes me to the tag.php page with the URL of the tag, for example: / tag / wordpress-1 /.</p> <p>I want to show all the posts of a the tags without having to set all of them. </p> <p>'tag' => 'post_tag' did not work, it shows nothing on...
[ { "answer_id": 254956, "author": "Anwer AR", "author_id": 83820, "author_profile": "https://wordpress.stackexchange.com/users/83820", "pm_score": 1, "selected": false, "text": "<p>This might work for you thought i've not tested.</p>\n\n<pre><code>$catsArray = array(159, 155, 143, 153, .....
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254946", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111513/" ]
I created the tag.php page and when I click on a tag on the page of a post it takes me to the tag.php page with the URL of the tag, for example: / tag / wordpress-1 /. I want to show all the posts of a the tags without having to set all of them. 'tag' => 'post\_tag' did not work, it shows nothing on the page. But w...
So I believe the question is how to get the terms back in the order of the Ids you've provided - which might not be sorted ascending or descending, but a random order instead. Surprisingly, I think there's a shortcut for that in WP - who knew? This, I believe, is what you want to use: ``` $catsArray = array(159, 155,...
254,949
<p>Can anybody tell me how I can add a "data-track" tag to the links in my menu. When I go to the dashboard -> menus, I can add any custom HTML.</p> <p>I would like it to go from this:</p> <pre><code>&lt;a href="http://www.detailingwiki.org/articles/"&gt;Article index&lt;/a&gt; </code></pre> <p>to this:</p> <pre><c...
[ { "answer_id": 254956, "author": "Anwer AR", "author_id": 83820, "author_profile": "https://wordpress.stackexchange.com/users/83820", "pm_score": 1, "selected": false, "text": "<p>This might work for you thought i've not tested.</p>\n\n<pre><code>$catsArray = array(159, 155, 143, 153, .....
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254949", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112394/" ]
Can anybody tell me how I can add a "data-track" tag to the links in my menu. When I go to the dashboard -> menus, I can add any custom HTML. I would like it to go from this: ``` <a href="http://www.detailingwiki.org/articles/">Article index</a> ``` to this: ``` <a data-track="navigation|click|article-index" href=...
So I believe the question is how to get the terms back in the order of the Ids you've provided - which might not be sorted ascending or descending, but a random order instead. Surprisingly, I think there's a shortcut for that in WP - who knew? This, I believe, is what you want to use: ``` $catsArray = array(159, 155,...
254,950
<p>I need to run a function on my Wordpress, on every page of the site you'll visit, on every device, and template used (PC, Tablet, Mobile, ...).</p> <p>This function will check if a Cookie has been set. If yes, great, else, if you click a certain link, it will set that Cookie based on some parameters.</p>
[ { "answer_id": 254952, "author": "Anwer AR", "author_id": 83820, "author_profile": "https://wordpress.stackexchange.com/users/83820", "pm_score": 2, "selected": false, "text": "<p>Generally functions hooked with <code>init</code> action will be available on every page and posts with in W...
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254950", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111037/" ]
I need to run a function on my Wordpress, on every page of the site you'll visit, on every device, and template used (PC, Tablet, Mobile, ...). This function will check if a Cookie has been set. If yes, great, else, if you click a certain link, it will set that Cookie based on some parameters.
Generally functions hooked with `init` action will be available on every page and posts with in WordPress. it will immediately fire upon WP load. so maybe something like below will work. ``` function ao_check_cookie() { //Your code here. } add_action( 'init', 'ao_check_cookie' ); ```
254,951
<p>I want to use </p> <pre><code>add_filter('the_content',...........) </code></pre> <p>however, I want that filter only to affect main post's content. See phseudo-example:</p> <pre><code>&lt;html&gt; ....... &lt;meta decsription&gt;.....the_content...&lt;/meta&gt; ....... &lt;left_widget&gt;....the_content...&lt;/l...
[ { "answer_id": 254954, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 1, "selected": false, "text": "<p>This is quite simple, see code below.</p>\n\n<pre><code>add_filter( 'the_content', 'my_the_content_filt...
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254951", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33667/" ]
I want to use ``` add_filter('the_content',...........) ``` however, I want that filter only to affect main post's content. See phseudo-example: ``` <html> ....... <meta decsription>.....the_content...</meta> ....... <left_widget>....the_content...</left_widget> ....... <MAIN_POST>....the_content...</MAIN_POST> ...
**This method doesn't work. I leave this answer only as reference.** If I understand correctly, the easier way is to check if you are in the main query inside the filter's callback: ``` add_filter( 'the_content', 'cyb_filter_content' ); function cyb_filter_content( $content ) { if( is_main_query() ) { /...
254,970
<p>I am working on an update to a WordPress plugin with some major changes and need to explain these changes to the user after they update the plugin. I am able to redirect the user to a welcome page if they manually install the plugin as I can use the activation hook, but it doesn't work if they update the plugin from...
[ { "answer_id": 254954, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 1, "selected": false, "text": "<p>This is quite simple, see code below.</p>\n\n<pre><code>add_filter( 'the_content', 'my_the_content_filt...
2017/02/02
[ "https://wordpress.stackexchange.com/questions/254970", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/60788/" ]
I am working on an update to a WordPress plugin with some major changes and need to explain these changes to the user after they update the plugin. I am able to redirect the user to a welcome page if they manually install the plugin as I can use the activation hook, but it doesn't work if they update the plugin from th...
**This method doesn't work. I leave this answer only as reference.** If I understand correctly, the easier way is to check if you are in the main query inside the filter's callback: ``` add_filter( 'the_content', 'cyb_filter_content' ); function cyb_filter_content( $content ) { if( is_main_query() ) { /...
254,980
<p>I have two different kinds of single posts, blog and products, built in the same way with post categories. The blog has three static categories that the user will use, News, Updates, and Ideas. This is as far as I've gotten in figuring it out:</p> <pre><code>if (is_single('cat=5')) { // show sidebar code for ...
[ { "answer_id": 254954, "author": "KAGG Design", "author_id": 108721, "author_profile": "https://wordpress.stackexchange.com/users/108721", "pm_score": 1, "selected": false, "text": "<p>This is quite simple, see code below.</p>\n\n<pre><code>add_filter( 'the_content', 'my_the_content_filt...
2017/02/03
[ "https://wordpress.stackexchange.com/questions/254980", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112410/" ]
I have two different kinds of single posts, blog and products, built in the same way with post categories. The blog has three static categories that the user will use, News, Updates, and Ideas. This is as far as I've gotten in figuring it out: ``` if (is_single('cat=5')) { // show sidebar code for cat=5 } else { ...
**This method doesn't work. I leave this answer only as reference.** If I understand correctly, the easier way is to check if you are in the main query inside the filter's callback: ``` add_filter( 'the_content', 'cyb_filter_content' ); function cyb_filter_content( $content ) { if( is_main_query() ) { /...
254,989
<p>I want to show 5 posts per page but limit total number of posts being resulted in a loop.</p> <pre><code>$args = array( 'post_type' =&gt; 'post', 'posts_per_page' =&gt; 5, 'paged' =&gt; $paged ); </code></pre> <p>Suppose, I have 100 posts and the above query args will display 5 posts per page and I can see 2...
[ { "answer_id": 254991, "author": "Anand", "author_id": 112423, "author_profile": "https://wordpress.stackexchange.com/users/112423", "pm_score": -1, "selected": false, "text": "<p>You can set the post limit in two ways:</p>\n\n<pre><code>1) wp-admin &gt; Settings &gt; Reading\n\n2) By pa...
2017/02/03
[ "https://wordpress.stackexchange.com/questions/254989", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112421/" ]
I want to show 5 posts per page but limit total number of posts being resulted in a loop. ``` $args = array( 'post_type' => 'post', 'posts_per_page' => 5, 'paged' => $paged ); ``` Suppose, I have 100 posts and the above query args will display 5 posts per page and I can see 20 pages. So, how can I limit the to...
You can use the [`found_posts` filter](https://codex.wordpress.org/Plugin_API/Filter_Reference/found_posts) to alter the number of posts WordPress reports finding from a query. ``` add_filter( 'found_posts', 'wpd_found_posts', 10, 2 ); function wpd_found_posts( $found_posts, $query ) { if ( $query->is_home() && $q...
255,045
<p>I am using an <code>:after</code> pseudo selector to place some text after an element on my page. I would like for this text to be content managed using Advanced Custom Fields, but I am not able to get it to work. Here is my code:</p> <pre><code>&lt;style&gt; .hc-copy:after { content:"&lt;?php the_field...
[ { "answer_id": 255060, "author": "Anwer AR", "author_id": 83820, "author_profile": "https://wordpress.stackexchange.com/users/83820", "pm_score": 0, "selected": false, "text": "<p>If that piece of css is in any php file then it should work as you expect. so double check your ACF Field an...
2017/02/03
[ "https://wordpress.stackexchange.com/questions/255045", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38829/" ]
I am using an `:after` pseudo selector to place some text after an element on my page. I would like for this text to be content managed using Advanced Custom Fields, but I am not able to get it to work. Here is my code: ``` <style> .hc-copy:after { content:"<?php the_field('hero_paragraph'); ?>"; d...
To make sure your fields are populated use the following code to print all the values that are set: ``` <?php var_dump( get_fields() ); ?> ``` The 'hero\_paragraph' key should be present somewhere in the printed values.
255,071
<p>I have a Wordpress theme (the7) that includes the Visual Composer plugin. This is good for my clients editing stuff in the back end, but it also adds unnecessary CSS and JS to every page load on the front end. How can I remove these?</p> <p>The lines it adds are:</p> <pre><code>&lt;link rel='stylesheet' id='js_com...
[ { "answer_id": 255084, "author": "maheshwaghmare", "author_id": 52167, "author_profile": "https://wordpress.stackexchange.com/users/52167", "pm_score": 2, "selected": false, "text": "<p>You need to use action <code>wp_enqueue_scripts</code> except <code>wp_head</code> like:</p>\n\n<pre><...
2017/02/03
[ "https://wordpress.stackexchange.com/questions/255071", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5445/" ]
I have a Wordpress theme (the7) that includes the Visual Composer plugin. This is good for my clients editing stuff in the back end, but it also adds unnecessary CSS and JS to every page load on the front end. How can I remove these? The lines it adds are: ``` <link rel='stylesheet' id='js_composer_front-css' href='...
You need to use action `wp_enqueue_scripts` except `wp_head` like: ``` function inf_remove_junk() { if (!is_admin()) { wp_dequeue_style('js_composer_front'); wp_dequeue_style('js_composer_custom_css'); wp_dequeue_script('wpb_composer_front_js'); } } add_action( 'wp_enqueue_scri...
255,077
<p>I've developed some functionality for a company website around job postings. There is a custom post type, with specialized fields, and a widget that displays a summary of current job postings. It's 5 functions and a widget class that was hobbled together from various websites etc and dumped into functions.php. It wo...
[ { "answer_id": 255079, "author": "maheshwaghmare", "author_id": 52167, "author_profile": "https://wordpress.stackexchange.com/users/52167", "pm_score": 0, "selected": false, "text": "<p>You can use:</p>\n\n<pre><code>function activate_my_careers() {\n add_action( 'init', 'create_care...
2017/02/03
[ "https://wordpress.stackexchange.com/questions/255077", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/101491/" ]
I've developed some functionality for a company website around job postings. There is a custom post type, with specialized fields, and a widget that displays a summary of current job postings. It's 5 functions and a widget class that was hobbled together from various websites etc and dumped into functions.php. It works...
If all you want is for your plugin to work, simply replace ``` register_activation_hook( __FILE__, 'activate_my_careers' ); ``` with ``` add_action( 'plugins_loaded', 'activate_my_careers' ); ``` If you want to understand why your new plugin isn't working, then you need to understand WordPress hooks. I would enc...
255,088
<p>So I'm developing this plugin to take the input of a form, puts it in a .CSV document then send the .CSV document over via email. And all this works fine. However, on pressing submit, a rouge file downloads named 'download'. When this file is opened up in my text editor, it seems to just be the complied code of the ...
[ { "answer_id": 255079, "author": "maheshwaghmare", "author_id": 52167, "author_profile": "https://wordpress.stackexchange.com/users/52167", "pm_score": 0, "selected": false, "text": "<p>You can use:</p>\n\n<pre><code>function activate_my_careers() {\n add_action( 'init', 'create_care...
2017/02/03
[ "https://wordpress.stackexchange.com/questions/255088", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112485/" ]
So I'm developing this plugin to take the input of a form, puts it in a .CSV document then send the .CSV document over via email. And all this works fine. However, on pressing submit, a rouge file downloads named 'download'. When this file is opened up in my text editor, it seems to just be the complied code of the pag...
If all you want is for your plugin to work, simply replace ``` register_activation_hook( __FILE__, 'activate_my_careers' ); ``` with ``` add_action( 'plugins_loaded', 'activate_my_careers' ); ``` If you want to understand why your new plugin isn't working, then you need to understand WordPress hooks. I would enc...
255,094
<p>I Have this simple following code :</p> <pre><code>&lt;?php //if "email" variable is filled out, send email if (isset($_POST['email'])) { //Email information $to = get_option( 'admin_email' ); $headers = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; //send em...
[ { "answer_id": 255093, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": true, "text": "<p>Yes, you should have quite reasonable options to customize upload, there are plenty of existing solutions around.</p...
2017/02/03
[ "https://wordpress.stackexchange.com/questions/255094", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/102912/" ]
I Have this simple following code : ``` <?php //if "email" variable is filled out, send email if (isset($_POST['email'])) { //Email information $to = get_option( 'admin_email' ); $headers = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; //send email wp_mail($...
Yes, you should have quite reasonable options to customize upload, there are plenty of existing solutions around. As for specifics I am not sure on "database" as image storage option. They typical solutions that I've heard of are: * dedicated location behind CDN (or some variation of); * dedicated image storage servi...
255,133
<p>After hours and hours of trying i can't get my head around it, I'm trying to <code>wp_enqueue_script</code> my custom js but WordPress is always looking for it in the parent theme folder, here is what i have tried lately without any success.</p> <p>My parent theme is Twentysixteen,</p> <p>Directly <code>wp_enqueue...
[ { "answer_id": 255217, "author": "Matthieu Ducorps", "author_id": 110467, "author_profile": "https://wordpress.stackexchange.com/users/110467", "pm_score": 3, "selected": true, "text": "<p>This is the proper way to load a custom javascript in your child theme, <code>wp_localize_script</c...
2017/02/04
[ "https://wordpress.stackexchange.com/questions/255133", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110467/" ]
After hours and hours of trying i can't get my head around it, I'm trying to `wp_enqueue_script` my custom js but WordPress is always looking for it in the parent theme folder, here is what i have tried lately without any success. My parent theme is Twentysixteen, Directly `wp_enqueue_script`: ``` function assets() ...
This is the proper way to load a custom javascript in your child theme, `wp_localize_script` is only necessary if you need to exchange data between JS and PHP (Client and server). ``` function assets() { wp_register_script('ajax_filter', get_stylesheet_directory_uri() . '/js/ajax-filter-posts.js', ['jquery'], '1....
255,137
<p>I am working on a wordpress calendar plugin and ran into a issue with custom fields. I can do two separate queries one for repeat events and one for static events but when I try to combine them my script processes until the server crashes and restarts mysql...</p> <pre><code>$args = array( 'numberposts' =&gt...
[ { "answer_id": 255217, "author": "Matthieu Ducorps", "author_id": 110467, "author_profile": "https://wordpress.stackexchange.com/users/110467", "pm_score": 3, "selected": true, "text": "<p>This is the proper way to load a custom javascript in your child theme, <code>wp_localize_script</c...
2017/02/04
[ "https://wordpress.stackexchange.com/questions/255137", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71277/" ]
I am working on a wordpress calendar plugin and ran into a issue with custom fields. I can do two separate queries one for repeat events and one for static events but when I try to combine them my script processes until the server crashes and restarts mysql... ``` $args = array( 'numberposts' => -1, 'post_ty...
This is the proper way to load a custom javascript in your child theme, `wp_localize_script` is only necessary if you need to exchange data between JS and PHP (Client and server). ``` function assets() { wp_register_script('ajax_filter', get_stylesheet_directory_uri() . '/js/ajax-filter-posts.js', ['jquery'], '1....