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
304,525
<p>I am trying to implement Panel Color in the Inspector Control for a custom block but can't seem to figure it out. Below is the JSX code that attempts it. It renders the block, but when it's in focus, it encounters a <a href="http://reactjs.org/docs/error-decoder.html?invariant=130&amp;args[]=undefined&amp;args[]=" r...
[ { "answer_id": 304562, "author": "developerjack", "author_id": 144350, "author_profile": "https://wordpress.stackexchange.com/users/144350", "pm_score": 4, "selected": true, "text": "<p>Many <code>wp.blocks.*</code> controls have been moved to <code>wp.editor.*</code> (see <a href=\"http...
2018/05/26
[ "https://wordpress.stackexchange.com/questions/304525", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106269/" ]
I am trying to implement Panel Color in the Inspector Control for a custom block but can't seem to figure it out. Below is the JSX code that attempts it. It renders the block, but when it's in focus, it encounters a [Minified React error #130](http://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&ar...
Many `wp.blocks.*` controls have been moved to `wp.editor.*` (see [release notes](https://github.com/WordPress/gutenberg/blob/v2.9.2/docs/reference/deprecated.md#310)). Specifically `wp.blocks.InspectorControls` is now `wp.editor.InspectorControls` - you'll need to change the first line of your code. *Note: `register...
304,558
<p>I am using the code below to sort code as per <code>meta_value</code>. But in this specific Column I have dates displayed for example: 20 April 2018 or 01 June 2018</p> <p>The sorting works sort of but now when I order the columns it displays it like 29 April 2018, 29 May 2018, 29 June 2018, 28 April 2018, 28 May 2...
[ { "answer_id": 304559, "author": "cybmeta", "author_id": 37428, "author_profile": "https://wordpress.stackexchange.com/users/37428", "pm_score": 0, "selected": false, "text": "<p>You need dates to be stored in a sortable format. For example, MySQL date format (which is the date format Wo...
2018/05/27
[ "https://wordpress.stackexchange.com/questions/304558", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/138622/" ]
I am using the code below to sort code as per `meta_value`. But in this specific Column I have dates displayed for example: 20 April 2018 or 01 June 2018 The sorting works sort of but now when I order the columns it displays it like 29 April 2018, 29 May 2018, 29 June 2018, 28 April 2018, 28 May 2018, 28 June 2018...a...
By default meta values will be treated as strings, leading to the result that you get. As you can see from the [codex on `wp_query`](https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters) you can force a comparison with different formats by defining a `meta_type`. Like this: ``` $query-...
304,568
<p>I have a website which uses wordpress. It was initially uploaded and used without SSL. After installing a server certificate and adding the apache virtualhost file for the ssl site, I tried loading the https version. It loaded with a lot of warnings about insecure content being trimmed. The resulting webpage was loo...
[ { "answer_id": 304559, "author": "cybmeta", "author_id": 37428, "author_profile": "https://wordpress.stackexchange.com/users/37428", "pm_score": 0, "selected": false, "text": "<p>You need dates to be stored in a sortable format. For example, MySQL date format (which is the date format Wo...
2018/05/27
[ "https://wordpress.stackexchange.com/questions/304568", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28555/" ]
I have a website which uses wordpress. It was initially uploaded and used without SSL. After installing a server certificate and adding the apache virtualhost file for the ssl site, I tried loading the https version. It loaded with a lot of warnings about insecure content being trimmed. The resulting webpage was lookin...
By default meta values will be treated as strings, leading to the result that you get. As you can see from the [codex on `wp_query`](https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters) you can force a comparison with different formats by defining a `meta_type`. Like this: ``` $query-...
304,571
<p>Where is this CSS code?</p> <p>I mean the <code>margin-top: 46px !important!;</code> I need to change it to <code>1px</code> to rid of top margin. But i didn't found it in any theme's files.</p> <p><strong>Note: I have searched the texts in all files using <a href="https://www.fileseek.ca/Download/" rel="nofollow ...
[ { "answer_id": 304574, "author": "Afnan abbasi", "author_id": 144224, "author_profile": "https://wordpress.stackexchange.com/users/144224", "pm_score": 2, "selected": false, "text": "<p>Here's what you can do about this:</p>\n\n<ul>\n<li>There may be a plugin which is loading this CSS so...
2018/05/27
[ "https://wordpress.stackexchange.com/questions/304571", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/137466/" ]
Where is this CSS code? I mean the `margin-top: 46px !important!;` I need to change it to `1px` to rid of top margin. But i didn't found it in any theme's files. **Note: I have searched the texts in all files using [FileSeek Pro](https://www.fileseek.ca/Download/)**. But didn't found anything. (even with Inspect Elem...
The CSS code you're seeing is added by core of WP when admin bar is showing. The function that outputs it is called [`_admin_bar_bump_cb()`](https://developer.wordpress.org/reference/functions/_admin_bar_bump_cb/) and it's called as hook on `wp_head`. So how to get rid of it? Just remove this action from that hook: ...
304,582
<p>I want to hide widgets from home page when user logged in I need help..</p>
[ { "answer_id": 304584, "author": "dhirenpatel22", "author_id": 124380, "author_profile": "https://wordpress.stackexchange.com/users/124380", "pm_score": -1, "selected": false, "text": "<p>You can use third-party WordPress plugin \"<strong>AH Display Widgets</strong>\" to show/hide widget...
2018/05/27
[ "https://wordpress.stackexchange.com/questions/304582", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144363/" ]
I want to hide widgets from home page when user logged in I need help..
Probably simplest, though not always optimal, is to use CSS. In the vast majority of WordPress themes (ones assigning body classes), `logged-in` and `home` will be applied to the body tag automatically, when appropriate, and every widget gets a unique ID wherever it's displayed. So, if I wanted to hide a given widget...
304,585
<p>In a WordPress post, these multiple values exist for a custom metadata with the key "client"</p> <pre><code>client=&gt;Andy client=&gt;Johny client=&gt;April </code></pre> <p>I want to add a new metadata only if its value does not exist,</p> <p>Result wanted: client=>Andy will not be added because it already exi...
[ { "answer_id": 304590, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>OK, so you have some code that uses <code>add_post_meta</code> and you want to make it add only unique...
2018/05/27
[ "https://wordpress.stackexchange.com/questions/304585", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/132569/" ]
In a WordPress post, these multiple values exist for a custom metadata with the key "client" ``` client=>Andy client=>Johny client=>April ``` I want to add a new metadata only if its value does not exist, Result wanted: client=>Andy will not be added because it already exists. client=>Susan will be added because ...
OK, so you have some code that uses `add_post_meta` and you want to make it add only unique values. The problem in here is that [`add_post_meta`](https://codex.wordpress.org/Function_Reference/add_post_meta) does exactly what it's name is saying - it adds a post meta value. There is 4th arg for that function that's ca...
304,601
<p>all Inner pages are working fine but home page is not working admin is working fine </p> <p>home page not working I have added wp-confing file </p> <pre><code>define('WP_DEBUG', true); define('WP_ALLOW_REPAIR', true); define( 'WP_DEBUG_DISPLAY', true ); </code></pre> <p>but not get any error </p> <p>home pag...
[ { "answer_id": 304590, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>OK, so you have some code that uses <code>add_post_meta</code> and you want to make it add only unique...
2018/05/28
[ "https://wordpress.stackexchange.com/questions/304601", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135085/" ]
all Inner pages are working fine but home page is not working admin is working fine home page not working I have added wp-confing file ``` define('WP_DEBUG', true); define('WP_ALLOW_REPAIR', true); define( 'WP_DEBUG_DISPLAY', true ); ``` but not get any error home page dispaly blank I have check all plugin dis...
OK, so you have some code that uses `add_post_meta` and you want to make it add only unique values. The problem in here is that [`add_post_meta`](https://codex.wordpress.org/Function_Reference/add_post_meta) does exactly what it's name is saying - it adds a post meta value. There is 4th arg for that function that's ca...
304,614
<p>This is both a question on 'how to do this', as well as 'should I do this'. </p> <p>I have the ACF-heavy site, where I would like to make the permalinks based on one of the ACF-fields (let's call it <code>foo</code>). If the <code>foo</code>-field has the value <code>123</code>, then I would like the permalink to t...
[ { "answer_id": 304926, "author": "DevLime", "author_id": 144484, "author_profile": "https://wordpress.stackexchange.com/users/144484", "pm_score": 0, "selected": false, "text": "<p>This may be oversimplifying what I'm reading but rather than using ACF fields to control the permalink, to ...
2018/05/28
[ "https://wordpress.stackexchange.com/questions/304614", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128304/" ]
This is both a question on 'how to do this', as well as 'should I do this'. I have the ACF-heavy site, where I would like to make the permalinks based on one of the ACF-fields (let's call it `foo`). If the `foo`-field has the value `123`, then I would like the permalink to that page to be `http://example.org/s123` (t...
URLs made from CF ----------------- Well, you can do this in many ways... One of them would be to use `parse_request` filter and modify it's behavior, but it can easily mess something up. Another way would be to use `save_post` action and modify the posts `post_name`, so WordPress will work like normal, but the `post...
304,631
<p><a href="https://i.stack.imgur.com/lY553.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lY553.jpg" alt="["></a>Home page on my wordpress site displays url code before showing the text of my featured posts. They display normally once the post is called in their respective pages so the issue is jus...
[ { "answer_id": 304793, "author": "Aurovrata", "author_id": 52120, "author_profile": "https://wordpress.stackexchange.com/users/52120", "pm_score": 1, "selected": false, "text": "<p>If you <a href=\"https://codex.wordpress.org/Create_A_Network?\" rel=\"nofollow noreferrer\">install your W...
2018/05/28
[ "https://wordpress.stackexchange.com/questions/304631", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144393/" ]
[![[](https://i.stack.imgur.com/lY553.jpg)](https://i.stack.imgur.com/lY553.jpg)Home page on my wordpress site displays url code before showing the text of my featured posts. They display normally once the post is called in their respective pages so the issue is just on the home page. How do I prevent this from happeni...
If you [install your WordPress Multisite](https://codex.wordpress.org/Create_A_Network?) (wpms) from scratch on the server this issue should not arise. However, if you have installed your wpms on a local machine first and then moved/copied the entire installation including the database to your server, then you have to ...
304,709
<p>I have several forms that send mails. Some of the mails should be sent as html, others as plain text. Right now I set the html option like this:</p> <pre><code>add_action( 'phpmailer_init', 'mailer_config', 10, 1); function mailer_config(PHPMailer $mailer){ $mailer-&gt;IsHTML(true); } </code></pre> <p>But this i...
[ { "answer_id": 304724, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 2, "selected": false, "text": "<p>Here's an (untested) <em>PHPMailer</em> example to check for e.g. the <em>subject</em> and the <em>content ty...
2018/05/29
[ "https://wordpress.stackexchange.com/questions/304709", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10381/" ]
I have several forms that send mails. Some of the mails should be sent as html, others as plain text. Right now I set the html option like this: ``` add_action( 'phpmailer_init', 'mailer_config', 10, 1); function mailer_config(PHPMailer $mailer){ $mailer->IsHTML(true); } ``` But this implies that all the mails are...
Ok, following @birgire suggestions, I finally ended up using `wp_mail_content_type` filter in conjunction with an hidden field on my form. Php code is this: ``` add_filter( 'wp_mail_content_type', 'set_mailer_content_type' ); function set_mailer_content_type( $content_type ) { if(isset($_POST['ishtmlform'])){ return...
304,729
<p>I have a hierarchical taxonomy <code>filter</code> that contains locations and genres for posts with the custom type <code>artist</code>:</p> <pre><code>- Genre -- Hip Hop -- Trap -- Rap - Location -- Europe --- Germany --- Sweden --- Austria -- Asia --- China --- Japan --- Taiwan </code></pre> <p>Now I would like...
[ { "answer_id": 304858, "author": "IvanMunoz", "author_id": 143424, "author_profile": "https://wordpress.stackexchange.com/users/143424", "pm_score": 0, "selected": false, "text": "<p><strong>childless</strong> means:</p>\n\n<p>(boolean) Returns terms that have no children if taxonomy is ...
2018/05/29
[ "https://wordpress.stackexchange.com/questions/304729", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18713/" ]
I have a hierarchical taxonomy `filter` that contains locations and genres for posts with the custom type `artist`: ``` - Genre -- Hip Hop -- Trap -- Rap - Location -- Europe --- Germany --- Sweden --- Austria -- Asia --- China --- Japan --- Taiwan ``` Now I would like to use get\_terms() to only get the Countries (...
OK, so this is what I came up with: ``` function get_childless_term_children( $parent_id, $taxonomy ) { // get all childless $terms of this $taxonomy $terms = get_terms(array( 'taxonomy' => $taxonomy, 'childless' => true, )); foreach( $terms as $key => $term ) { // remove $terms that aren't descen...
304,734
<p>How to format the <strong>meta_value</strong> column's json from the <strong>post_meta</strong> table in wordpress to get only the proper values.</p> <p>I have the value something like:</p> <pre><code>$posttype= Mage::helper('wordpress')-&gt;getPostType2(); $posttype = explode(',',$posttype); echo 'Post type:'; ...
[ { "answer_id": 304772, "author": "SeventhSteel", "author_id": 17276, "author_profile": "https://wordpress.stackexchange.com/users/17276", "pm_score": 2, "selected": false, "text": "<p>Part 1 - To remove the double quotes/extra characters:</p>\n\n<p>Instead of trying regular expressions, ...
2018/05/29
[ "https://wordpress.stackexchange.com/questions/304734", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144468/" ]
How to format the **meta\_value** column's json from the **post\_meta** table in wordpress to get only the proper values. I have the value something like: ``` $posttype= Mage::helper('wordpress')->getPostType2(); $posttype = explode(',',$posttype); echo 'Post type:'; echo '<pre>';print_r($posttype); ``` **Output:...
Part 1 - To remove the double quotes/extra characters: Instead of trying regular expressions, since the output is somewhat predictable, I would try the following instead of the getCapitalLetters function: ``` function strip_cruft( $str ) { $str = str_replace( '";s', '', $str ); $str = str_replace( '"', '', $s...
304,735
<p>I want a non-WordPress page that can be accessed from a parent directory that is a WordPress page.</p> <p>For example, I want <code>http://example.com/city/</code> to be a WordPress page. However, I want to upload a non-WordPress page into the folder <code>/city/pricing/</code> on the server. When I try this, I can...
[ { "answer_id": 304739, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": false, "text": "<p>You can do it by adding a rule to htaccess that will load that page for that specific URL, and add the ru...
2018/05/29
[ "https://wordpress.stackexchange.com/questions/304735", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130837/" ]
I want a non-WordPress page that can be accessed from a parent directory that is a WordPress page. For example, I want `http://example.com/city/` to be a WordPress page. However, I want to upload a non-WordPress page into the folder `/city/pricing/` on the server. When I try this, I can go to `http://example.com/city/...
As @MarkKaplun suggests, it would be preferable to store this non-WordPress file in a different area of the filesystem altogether and rewrite the URL in `.htaccess`. Instead of mimicking the WordPress URL in the physical directory structure - which will likely only cause you (more) problems (not least that you would ne...
304,738
<p>I have a CPT that I would like to have the 'root'-permalinks:</p> <p>So for the page: 'Foo Bar' I would like that to have the URL:</p> <pre><code>https://example.org/foo-bar </code></pre> <p>I've found out that I achieve this by registering the CPT with the following line in the <code>args</code> for <code>regist...
[ { "answer_id": 304742, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": false, "text": "<p>Pages are hardcoded to be the default parsing possibility to any URL (or to say it differently, if nothin...
2018/05/29
[ "https://wordpress.stackexchange.com/questions/304738", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128304/" ]
I have a CPT that I would like to have the 'root'-permalinks: So for the page: 'Foo Bar' I would like that to have the URL: ``` https://example.org/foo-bar ``` I've found out that I achieve this by registering the CPT with the following line in the `args` for `register_post_type( 'my_CPT', $args );`: ``` 'rewrite'...
Pages are hardcoded to be the default parsing possibility to any URL (or to say it differently, if nothing else matches, wordpress will try to find a page there). Therefor it is unwise to put permalink structure with no "prefix", but if you really want it that way, just add a page with a "page" slug and make all other...
304,818
<p>I developed my theme. and I set header.php. </p> <p>And in Header.php, I set like this.</p> <pre><code>&lt;title&gt;My Site Name&lt;/title&gt; </code></pre> <p>This makes search-engine confuse. Every page and posts title in head tag are same with site-name. </p> <p>Do you have tips to set the title and meta tag ...
[ { "answer_id": 304828, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 3, "selected": true, "text": "<p>To properly set the title tag in a theme you shouldn't put it in header.php manually. Your header.php sh...
2018/05/30
[ "https://wordpress.stackexchange.com/questions/304818", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133185/" ]
I developed my theme. and I set header.php. And in Header.php, I set like this. ``` <title>My Site Name</title> ``` This makes search-engine confuse. Every page and posts title in head tag are same with site-name. Do you have tips to set the title and meta tag for SEO?
To properly set the title tag in a theme you shouldn't put it in header.php manually. Your header.php should have `wp_head()` somewhere between `<head></head>`, then you can let WordPress set the title tag by [adding support for `title-tag` to your theme](https://codex.wordpress.org/Title_Tag#Adding_Theme_Support): ``...
304,839
<p>I have a CPT called "domaines" (its like vineyards in french). My site have 2 languages (french and english), configured with Polylang for <strong>pages</strong> and <strong>menus</strong> translation.</p> <p>I don't want to use Polylang features for my "domaine" CPT translations to avoid duplicating posts : I want...
[ { "answer_id": 304828, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 3, "selected": true, "text": "<p>To properly set the title tag in a theme you shouldn't put it in header.php manually. Your header.php sh...
2018/05/30
[ "https://wordpress.stackexchange.com/questions/304839", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/73871/" ]
I have a CPT called "domaines" (its like vineyards in french). My site have 2 languages (french and english), configured with Polylang for **pages** and **menus** translation. I don't want to use Polylang features for my "domaine" CPT translations to avoid duplicating posts : I want to use ACF for translations (with a...
To properly set the title tag in a theme you shouldn't put it in header.php manually. Your header.php should have `wp_head()` somewhere between `<head></head>`, then you can let WordPress set the title tag by [adding support for `title-tag` to your theme](https://codex.wordpress.org/Title_Tag#Adding_Theme_Support): ``...
304,859
<pre><code>&lt;?php namespace wp_gdpr_wc\controller; use wp_gdpr\lib\Gdpr_Container; use wp_gdpr_wc\lib\Gdpr_Wc_Translation; use wp_gdpr_wc\model\Wc_Model; class Controller_Wc { const REQUEST_TYPE = 3; /** * Controller_Form_Submit constructor. */ public function __construct() { add_act...
[ { "answer_id": 304861, "author": "Alex", "author_id": 142375, "author_profile": "https://wordpress.stackexchange.com/users/142375", "pm_score": 5, "selected": true, "text": "<p>I did it using this function <code>remove_filters_with_method_name( 'woocommerce_after_order_notes', 'checkout_...
2018/05/30
[ "https://wordpress.stackexchange.com/questions/304859", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/142375/" ]
``` <?php namespace wp_gdpr_wc\controller; use wp_gdpr\lib\Gdpr_Container; use wp_gdpr_wc\lib\Gdpr_Wc_Translation; use wp_gdpr_wc\model\Wc_Model; class Controller_Wc { const REQUEST_TYPE = 3; /** * Controller_Form_Submit constructor. */ public function __construct() { add_action( 'wooc...
I did it using this function `remove_filters_with_method_name( 'woocommerce_after_order_notes', 'checkout_consent_checkbox', 10 );` ``` function remove_filters_with_method_name( $hook_name = '', $method_name = '', $priority = 0 ) { global $wp_filter; // Take only filters on right hook name and priority if ...
304,860
<p>Is there anyway I can add the user ID to the woocommerce customer dashboard? thanks!</p>
[ { "answer_id": 304863, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 1, "selected": false, "text": "<p>As with most mature plugins, Woocommerce offers a number of hooks to easily customize content such as the custo...
2018/05/30
[ "https://wordpress.stackexchange.com/questions/304860", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144494/" ]
Is there anyway I can add the user ID to the woocommerce customer dashboard? thanks!
WooCommerce doesn't provide any such hook to display User ID on the dashbaord. But you can add it by overwriting dashboard template into your theme file. You can view in brief of how to overwrite templates from below WooCommerce reference link. <https://docs.woocommerce.com/document/template-structure/> You need to ...
304,872
<p>I've checked multiple questions and can't seem to find the answer.</p> <p>How can I update a list of URLs to either include "-google" at the end of the permalink, or set the URL to a custom url. My list of URLs is 100+ and I have what the URL is and what the URL should be. </p> <p><strong>For example:</strong></p>...
[ { "answer_id": 304863, "author": "Steve", "author_id": 23132, "author_profile": "https://wordpress.stackexchange.com/users/23132", "pm_score": 1, "selected": false, "text": "<p>As with most mature plugins, Woocommerce offers a number of hooks to easily customize content such as the custo...
2018/05/30
[ "https://wordpress.stackexchange.com/questions/304872", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144544/" ]
I've checked multiple questions and can't seem to find the answer. How can I update a list of URLs to either include "-google" at the end of the permalink, or set the URL to a custom url. My list of URLs is 100+ and I have what the URL is and what the URL should be. **For example:** ``` https://examplesite.com/cust...
WooCommerce doesn't provide any such hook to display User ID on the dashbaord. But you can add it by overwriting dashboard template into your theme file. You can view in brief of how to overwrite templates from below WooCommerce reference link. <https://docs.woocommerce.com/document/template-structure/> You need to ...
304,878
<p>I'm trying to display a list of posts from a certain category that I can paginate through. Since I've read that <code>get_posts()</code> doesn't support pagination but <code>WP_Query</code> does, I'm using the latter.</p> <p>Here's my query:</p> <pre><code> $mainPosts = new WP_Query(array( 'post_type' ...
[ { "answer_id": 304879, "author": "idpokute", "author_id": 87895, "author_profile": "https://wordpress.stackexchange.com/users/87895", "pm_score": 1, "selected": false, "text": "<p>Probably some of your plugins use memory. If I were you, I would turn off all the plugins and try it again. ...
2018/05/30
[ "https://wordpress.stackexchange.com/questions/304878", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81297/" ]
I'm trying to display a list of posts from a certain category that I can paginate through. Since I've read that `get_posts()` doesn't support pagination but `WP_Query` does, I'm using the latter. Here's my query: ``` $mainPosts = new WP_Query(array( 'post_type' => 'post', 'posts_per_page' => ...
Your query looks OK, so I doubt that it will cause any problems. But then... Let's take a look at your loop: ``` if ($mainPosts->have_posts()) { while ($mainPosts->have_posts()) { $postItemImage = the_post_thumbnail_url(); ... echo "..."; } } ``` First of all you don't have any ...
304,882
<p>First let me know you that I have made a blog before and I have customize it according to the post format but I have customize it on the blog main page i.e. index.php.</p> <p>Now I am making a another blog and I want to customize it by post format but this time I want to customize the post on the read page i.e. sin...
[ { "answer_id": 304879, "author": "idpokute", "author_id": 87895, "author_profile": "https://wordpress.stackexchange.com/users/87895", "pm_score": 1, "selected": false, "text": "<p>Probably some of your plugins use memory. If I were you, I would turn off all the plugins and try it again. ...
2018/05/30
[ "https://wordpress.stackexchange.com/questions/304882", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/108146/" ]
First let me know you that I have made a blog before and I have customize it according to the post format but I have customize it on the blog main page i.e. index.php. Now I am making a another blog and I want to customize it by post format but this time I want to customize the post on the read page i.e. single.php (a...
Your query looks OK, so I doubt that it will cause any problems. But then... Let's take a look at your loop: ``` if ($mainPosts->have_posts()) { while ($mainPosts->have_posts()) { $postItemImage = the_post_thumbnail_url(); ... echo "..."; } } ``` First of all you don't have any ...
304,906
<p>I've registered a Customizer section called "Other Logos" and have used the <code>WP_Customize_Image_Control()</code> object to upload images that show up in the Customizer. I'm customizing Twentyseventeen in a child-theme. </p> <p>When I try to use <code>get_theme_mod()</code> or <code>get_option()</code>, to ret...
[ { "answer_id": 304923, "author": "eSparkBiz Team", "author_id": 144575, "author_profile": "https://wordpress.stackexchange.com/users/144575", "pm_score": 1, "selected": false, "text": "<p><strong>Step 1:</strong> Click on setting option</p>\n\n<p><a href=\"https://i.stack.imgur.com/dqm3G...
2018/05/30
[ "https://wordpress.stackexchange.com/questions/304906", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143897/" ]
I've registered a Customizer section called "Other Logos" and have used the `WP_Customize_Image_Control()` object to upload images that show up in the Customizer. I'm customizing Twentyseventeen in a child-theme. When I try to use `get_theme_mod()` or `get_option()`, to return an `src` for the `img` tag, I am not get...
Checking the demo, I see that you put `padding` and `margin` as zero, that's great. The reason you are seeing the space is that there is some content with white color and you are confusing it as space(padding or margin). [![enter image description here](https://i.stack.imgur.com/7vadW.jpg)](https://i.stack.imgur.com/7...
304,908
<p>I'm looking to split line items with a quantity > 1, into individual line items AFTER the order is received. I'm read a lot about this and see a bunch of great scripts that do this before the checkout process occurs such as <a href="https://businessbloomer.com/woocommerce-display-separate-cart-items-product-quantity...
[ { "answer_id": 305010, "author": "HectorOfTroy407", "author_id": 70239, "author_profile": "https://wordpress.stackexchange.com/users/70239", "pm_score": 2, "selected": true, "text": "<p>So I ended up combining a few answer out there and split out orders when adding to the cart, and also ...
2018/05/30
[ "https://wordpress.stackexchange.com/questions/304908", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/70239/" ]
I'm looking to split line items with a quantity > 1, into individual line items AFTER the order is received. I'm read a lot about this and see a bunch of great scripts that do this before the checkout process occurs such as <https://businessbloomer.com/woocommerce-display-separate-cart-items-product-quantity-1/> and <h...
So I ended up combining a few answer out there and split out orders when adding to the cart, and also when updating the cart. The below works, though it's purely a front end customization. Hope this helps someone else! ``` function bbloomer_split_product_individual_cart_items( $cart_item_data, $product_id ){ $unique...
304,960
<p>I'm trying to recieve post ID from link using ACF link field:</p> <pre><code>&lt;?php $link = get_sub_field('offer_link'); $id = get_the_ID(); if( $link ): ?&gt; &lt;a href="#post-&lt;?php echo $id; ?&gt;" target="&lt;?php echo $link['target']; ?&gt;"&gt;&lt;?php echo $link['title']; ?&gt;&lt;/a&gt; &l...
[ { "answer_id": 304967, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 2, "selected": false, "text": "<p>You can get a post's ID from a URL with <code>url_to_postid()</code>. Just pass it the URL to get the I...
2018/05/31
[ "https://wordpress.stackexchange.com/questions/304960", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/125792/" ]
I'm trying to recieve post ID from link using ACF link field: ``` <?php $link = get_sub_field('offer_link'); $id = get_the_ID(); if( $link ): ?> <a href="#post-<?php echo $id; ?>" target="<?php echo $link['target']; ?>"><?php echo $link['title']; ?></a> <?php endif; ?> ``` but instead of ID of link I ge...
The [Page Link documentation](https://www.advancedcustomfields.com/resources/page-link/) actually shows how to retrieve the ID from a Page Link field. Just needed to do this myself and came across it. It worked well for me. ``` <?php // vars $post_id = get_field('url', false, false); // check if( $post_id ): ?> <a...
304,981
<p>I call <code>$wpdb-&gt;query()</code> on a query like</p> <pre><code>INSERT INTO wp_ctt_timetables (name, homework, tod, class, dow, lesson) VALUES ('', '', '', 3, 0, 0); INSERT INTO wp_ctt_timetables (name, homework, tod, class, dow, lesson) VALUES ('', '', '', 3, 0, 1); INSERT INTO wp_ctt_timetables (name, homewo...
[ { "answer_id": 305116, "author": "XedinUnknown", "author_id": 64825, "author_profile": "https://wordpress.stackexchange.com/users/64825", "pm_score": 3, "selected": true, "text": "<h2>TL;DR</h2>\n\n<p>This is not possible with <code>wpdb</code>. Use <a href=\"https://developer.wordpress....
2018/05/31
[ "https://wordpress.stackexchange.com/questions/304981", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144617/" ]
I call `$wpdb->query()` on a query like ``` INSERT INTO wp_ctt_timetables (name, homework, tod, class, dow, lesson) VALUES ('', '', '', 3, 0, 0); INSERT INTO wp_ctt_timetables (name, homework, tod, class, dow, lesson) VALUES ('', '', '', 3, 0, 1); INSERT INTO wp_ctt_timetables (name, homework, tod, class, dow, lesson)...
TL;DR ----- This is not possible with `wpdb`. Use [`dbDelta()`](https://developer.wordpress.org/reference/functions/dbdelta/). Even better, use something else to run raw queries. Explanation ----------- `wpdb->query()` [uses](https://core.trac.wordpress.org/browser/tags/4.9/src/wp-includes/wp-db.php#L1924) the [`mys...
305,065
<p>I'm trying to write a plugin installer, akin to TGMPA, but just for its core functionality of actually installing the plugin and nothing more.</p> <p>I've identified that <code>Plugin_Upgrader</code> is what I need and decided to emulate this.</p> <pre><code>$plugin = THEME_DIR . '/Inc/Plugins/my-shortcodes.zip'; ...
[ { "answer_id": 305015, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 2, "selected": false, "text": "<h2>What constitutes personal data?</h2>\n\n<p>The GDPR applies to ‘personal data’ meaning any information relating ...
2018/06/01
[ "https://wordpress.stackexchange.com/questions/305065", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143406/" ]
I'm trying to write a plugin installer, akin to TGMPA, but just for its core functionality of actually installing the plugin and nothing more. I've identified that `Plugin_Upgrader` is what I need and decided to emulate this. ``` $plugin = THEME_DIR . '/Inc/Plugins/my-shortcodes.zip'; $options = array( 'packa...
Well, this has little to do with WordPress development as such, even if there is now a [special privacy function](https://developer.wordpress.org/reference/functions/the_privacy_policy_link/), but since I´ve been writing about online privacy for over 25 years now I´ll gladly answer. Let´s take a [look at the principles...
305,076
<p>I've already read <a href="https://wordpress.stackexchange.com/questions/72525/how-to-switch-between-the-primary-menus-programmatically">How to switch between the Primary Menus programmatically?</a> but it doesn't actually answer the question. The accepted answer is just two workarounds but not an actual answer to t...
[ { "answer_id": 305080, "author": "Liam Stewart", "author_id": 121955, "author_profile": "https://wordpress.stackexchange.com/users/121955", "pm_score": 2, "selected": false, "text": "<p>Sounds like you are looking for this:</p>\n\n<p>Add to <code>functions.php</code></p>\n\n<pre><code>$l...
2018/06/01
[ "https://wordpress.stackexchange.com/questions/305076", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112418/" ]
I've already read [How to switch between the Primary Menus programmatically?](https://wordpress.stackexchange.com/questions/72525/how-to-switch-between-the-primary-menus-programmatically) but it doesn't actually answer the question. The accepted answer is just two workarounds but not an actual answer to the question. ...
I dug through the wordpress code to see what was happening when I submitted the form from the admin UI to see what function it was calling (and did a `var_export()` on the variable being passed in) and saw it was calling `set_theme_mod( 'nav_menu_locations', $menu_locations );`. I've updated my code to use this and it ...
305,127
<p>I have created some theme page and I want to call <a href="https://wordpress.org/plugins/wp-customer-reviews/" rel="nofollow noreferrer">WP Customer Reviews</a> shortcode </p> <pre><code> echo do_shortcode('[WPCR_SHOW POSTID="' . $post-&gt;ID . '" NUM="1" HIDEREVIEWS="0" HIDERESPONSE="1" HIDECUSTOM="1" SHOWFORM="0"...
[ { "answer_id": 305109, "author": "Prashant Rawal", "author_id": 119111, "author_profile": "https://wordpress.stackexchange.com/users/119111", "pm_score": 0, "selected": false, "text": "<p>Let me first tell you how the firewall work. Firewall acts as a shield between your wordpress websit...
2018/06/02
[ "https://wordpress.stackexchange.com/questions/305127", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44959/" ]
I have created some theme page and I want to call [WP Customer Reviews](https://wordpress.org/plugins/wp-customer-reviews/) shortcode ``` echo do_shortcode('[WPCR_SHOW POSTID="' . $post->ID . '" NUM="1" HIDEREVIEWS="0" HIDERESPONSE="1" HIDECUSTOM="1" SHOWFORM="0"]'); ``` but it returns > > [WPCR\_SHOW POSTID="3...
There is no "WordPress Firewall". A [firewall](https://en.wikipedia.org/wiki/Firewall_(computing)) acts either on the network or on the host, never on a later stage such as a specific software running on a server. Everything that claims to be a firewall specific for WordPress is a scam. See the linked Wikipedia arti...
305,132
<p>I am developing a plugin, let's call it DahPlugin, that provides additional customizer options for a free theme I developed. Let's call this theme DahTheme (I don't want to shamelessly plug either one of them here).</p> <p>So what I am trying to accomplish is, I would like for <strong>DahPlugin</strong> to be autom...
[ { "answer_id": 305133, "author": "Nathan Johnson", "author_id": 106269, "author_profile": "https://wordpress.stackexchange.com/users/106269", "pm_score": 1, "selected": false, "text": "<p>I haven't tested this, so it might not work correctly, but the essence of what you're trying to do i...
2018/06/02
[ "https://wordpress.stackexchange.com/questions/305132", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/65047/" ]
I am developing a plugin, let's call it DahPlugin, that provides additional customizer options for a free theme I developed. Let's call this theme DahTheme (I don't want to shamelessly plug either one of them here). So what I am trying to accomplish is, I would like for **DahPlugin** to be automatically **deactivated*...
I haven't tested this, so it might not work correctly, but the essence of what you're trying to do is hook into the `after_switch_theme` hook and see if the `$old_name` is DahTheme. If it is, that means that the current theme isn't DahTheme, so you want to deactivate the plugin. ``` function wpse_after_switch_theme( $...
305,143
<pre><code>&lt;h1 class="page-title"&gt;&lt;?php esc_html_e( 'Oops! Something went wrong.', '_amnth' ); ?&gt;&lt;/h1&gt; </code></pre> <p>I think this should simply use the <code>__()</code> function, since it's a static string and it cannot be dynamic and in contrast, HTML.</p> <p>At the same time, here's some sourc...
[ { "answer_id": 305166, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>It depends... As in almost any case...</p>\n\n<blockquote>\n <p>So, is it whenever you output a stri...
2018/06/02
[ "https://wordpress.stackexchange.com/questions/305143", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143406/" ]
``` <h1 class="page-title"><?php esc_html_e( 'Oops! Something went wrong.', '_amnth' ); ?></h1> ``` I think this should simply use the `__()` function, since it's a static string and it cannot be dynamic and in contrast, HTML. At the same time, here's some source code from WooCommerce itself: ``` <th class="product...
You should always escape output. end of sentence, and end of story. The questions is like asking if you can use globals and goto. Sure they are part of the language and in some edge cases they are the only way to produce working and readable code, but the guide is to never use them unless you can prove you have too. ...
305,164
<p>We often use the Oembed function provided by the Wordpress to embed media.</p> <p>I have a condition where I am running a loop to fetch certain posts from a custom post type, but I want to skip posts in which Oembed is empty.</p> <p>How to check if Oembed is empty or has a URL in meta of single.php.</p> <p>I trie...
[ { "answer_id": 305165, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>It’s a little hard to guess what’s your question really is and what exactly you want to check...</p>\...
2018/06/03
[ "https://wordpress.stackexchange.com/questions/305164", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
We often use the Oembed function provided by the Wordpress to embed media. I have a condition where I am running a loop to fetch certain posts from a custom post type, but I want to skip posts in which Oembed is empty. How to check if Oembed is empty or has a URL in meta of single.php. I tried something like this → ...
The [`wp_oembed_get()`](https://codex.wordpress.org/Function_Reference/wp_oembed_get) only works for supported oEmbed providers. The return value is also is a URL of false, as mentioned per codex: > > If $url is a valid url to a supported provider, the function returns > the embed code provided to it from the oEmbe...
305,195
<p>Suppose the editor on my admin dashboard creates the following HTML (when I print to the webpage using <code>the_content()</code>:</p> <pre><code>&lt;blockquote&gt;Hello this is the best quote in the world!&lt;/blockquote&gt; &lt;blockquote&gt;Hello this is the second best quote in the world!&lt;/blockquote&gt; &lt...
[ { "answer_id": 305196, "author": "David Sword", "author_id": 132362, "author_profile": "https://wordpress.stackexchange.com/users/132362", "pm_score": 3, "selected": true, "text": "<p>You can use <a href=\"https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content\" rel=\"nofoll...
2018/06/03
[ "https://wordpress.stackexchange.com/questions/305195", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144745/" ]
Suppose the editor on my admin dashboard creates the following HTML (when I print to the webpage using `the_content()`: ``` <blockquote>Hello this is the best quote in the world!</blockquote> <blockquote>Hello this is the second best quote in the world!</blockquote> <blockquote>Hello this is the third best quote in th...
You can use [`the_content`](https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content) [filter](https://codex.wordpress.org/Plugin_API/Hooks), to literally filter the content into your structure. Somthing like this ``` <?php add_filter('the_content',function($the_content){ // find blockquotes $rege...
305,205
<pre><code> &lt;div class="vp-field vp-checkbox vp-checked-field vp-meta-single" data-vp-type="vp-checkbox" id="_custom_meta[category][]"&gt; &lt;div class="label"&gt; &lt;label&gt;Categories&lt;/label&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;div class="input"&gt; &lt;label&gt; &lt;inpu...
[ { "answer_id": 305210, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 0, "selected": false, "text": "<p>Your code:</p>\n\n<pre><code>$features[0] = \"star\";\n$features[1] = \"triangle\";\n$features[2] = \"square\";...
2018/06/03
[ "https://wordpress.stackexchange.com/questions/305205", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/137606/" ]
``` <div class="vp-field vp-checkbox vp-checked-field vp-meta-single" data-vp-type="vp-checkbox" id="_custom_meta[category][]"> <div class="label"> <label>Categories</label> </div> <div class="field"> <div class="input"> <label> <input class="vp-input" type="checkbox" name="_custom_meta[cate...
Ok, so probably the meta data is saved correctly, now we are going to retrieve it. I'm not sure where and how you're adding this code, it looks like a metabox? The checkboxes aren't magicly getting checked, you need to add some logic to it. First we need to have a closer look how you save the checkbox data. We want ...
305,240
<p>I have <code>wp_nav_menu</code></p> <pre><code>&lt;nav class="site-nav links-to-floor"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#our-menu"&gt;Our Menu&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Events&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a hr...
[ { "answer_id": 305242, "author": "cjbj", "author_id": 75495, "author_profile": "https://wordpress.stackexchange.com/users/75495", "pm_score": 1, "selected": false, "text": "<p>You have at least three options, depending on how extensive your demands are:</p>\n\n<ol>\n<li>There is a filter...
2018/06/04
[ "https://wordpress.stackexchange.com/questions/305240", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144773/" ]
I have `wp_nav_menu` ``` <nav class="site-nav links-to-floor"> <ul> <li><a href="#home">Home</a></li> <li><a href="#our-menu">Our Menu</a></li> <li><a href="#">Events</a></li> <li><a href="#">Galleries</a></li> <li><a href="#">Contact Us</a></li> </ul> </nav> ``` I want to add `data-id="1" data-s...
You have at least three options, depending on how extensive your demands are: 1. There is a filter towards the end of [`wp_nav_menu`](https://developer.wordpress.org/reference/functions/wp_nav_menu/) that lets you change the function's output. If the menu is fixed you could use this to do a simple find and replace on ...
305,246
<p>The Buddypress 3.0 uses <strong>bp-nouveau</strong> template as default. How can I override the CSS and other template files in WordPress theme? Earlier it would be done by copying <strong>bp-legacy</strong> folder into the WordPress theme folder and renaming it to <strong>buddypress</strong> but it does not seem to...
[ { "answer_id": 332068, "author": "cdrck", "author_id": 163449, "author_profile": "https://wordpress.stackexchange.com/users/163449", "pm_score": 2, "selected": false, "text": "<p>I know it is an old question but im pasting this here in case someone is looking for the same answer.</p>\n\n...
2018/06/04
[ "https://wordpress.stackexchange.com/questions/305246", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144778/" ]
The Buddypress 3.0 uses **bp-nouveau** template as default. How can I override the CSS and other template files in WordPress theme? Earlier it would be done by copying **bp-legacy** folder into the WordPress theme folder and renaming it to **buddypress** but it does not seem to work for the bp-nouveau theme. Even if I ...
I know it is an old question but im pasting this here in case someone is looking for the same answer. **Overloading Template Compatibility theme files** Template compatibility also runs a check to see if two directories or folders exist in a theme: ``` 'buddypress' 'community' ``` If either of these two folders exi...
305,249
<p>I'm developing a website where the username is a document number, called CPF (think of it as a national ID), which has the following mask:</p> <pre><code>000.000.000-00 </code></pre> <p>I'm storing the usernames as plain numbers, but all our forms must have the mask above, which in turn makes it so the <code>_POST...
[ { "answer_id": 332068, "author": "cdrck", "author_id": 163449, "author_profile": "https://wordpress.stackexchange.com/users/163449", "pm_score": 2, "selected": false, "text": "<p>I know it is an old question but im pasting this here in case someone is looking for the same answer.</p>\n\n...
2018/06/04
[ "https://wordpress.stackexchange.com/questions/305249", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28130/" ]
I'm developing a website where the username is a document number, called CPF (think of it as a national ID), which has the following mask: ``` 000.000.000-00 ``` I'm storing the usernames as plain numbers, but all our forms must have the mask above, which in turn makes it so the `_POST['user_login']` always goes wit...
I know it is an old question but im pasting this here in case someone is looking for the same answer. **Overloading Template Compatibility theme files** Template compatibility also runs a check to see if two directories or folders exist in a theme: ``` 'buddypress' 'community' ``` If either of these two folders exi...
305,280
<p>I'm trying to include all my css and JS files of a theme using <code>functions.php</code>. Following is what I have done so far:</p> <pre><code> &lt;?php function blogroom() { wp_enqueue_style('bootstrap', get_stylesheet_directory_uri() . '/assets/lib/bootstrap/dist/css/bootstrap.min.css'); w...
[ { "answer_id": 332068, "author": "cdrck", "author_id": 163449, "author_profile": "https://wordpress.stackexchange.com/users/163449", "pm_score": 2, "selected": false, "text": "<p>I know it is an old question but im pasting this here in case someone is looking for the same answer.</p>\n\n...
2018/06/04
[ "https://wordpress.stackexchange.com/questions/305280", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144795/" ]
I'm trying to include all my css and JS files of a theme using `functions.php`. Following is what I have done so far: ``` <?php function blogroom() { wp_enqueue_style('bootstrap', get_stylesheet_directory_uri() . '/assets/lib/bootstrap/dist/css/bootstrap.min.css'); wp_enqueue_style('loaders', ...
I know it is an old question but im pasting this here in case someone is looking for the same answer. **Overloading Template Compatibility theme files** Template compatibility also runs a check to see if two directories or folders exist in a theme: ``` 'buddypress' 'community' ``` If either of these two folders exi...
305,347
<p>I'm trying to replace the default image picked by yoast (featured image) with a custom with the relative og:image:width and og:image:height, but seems a mission impossible!</p> <p>I tryed with this:</p> <pre><code>function my_own_og_function() { $my_image_url = 'http://www.mywebsite.net/wp-content/uploads/TEST...
[ { "answer_id": 332068, "author": "cdrck", "author_id": 163449, "author_profile": "https://wordpress.stackexchange.com/users/163449", "pm_score": 2, "selected": false, "text": "<p>I know it is an old question but im pasting this here in case someone is looking for the same answer.</p>\n\n...
2018/06/05
[ "https://wordpress.stackexchange.com/questions/305347", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144842/" ]
I'm trying to replace the default image picked by yoast (featured image) with a custom with the relative og:image:width and og:image:height, but seems a mission impossible! I tryed with this: ``` function my_own_og_function() { $my_image_url = 'http://www.mywebsite.net/wp-content/uploads/TEST-A.jpg'; $GLOBALS...
I know it is an old question but im pasting this here in case someone is looking for the same answer. **Overloading Template Compatibility theme files** Template compatibility also runs a check to see if two directories or folders exist in a theme: ``` 'buddypress' 'community' ``` If either of these two folders exi...
305,353
<p>I'm using a theme child of <a href="https://wordpress.org/themes/ultra/" rel="nofollow noreferrer">Ultra Theme</a>. This theme is using this : </p> <pre><code>add_theme_support( 'title-tag' ); </code></pre> <p>I'd like to customize the title tag of all posts &amp; pages, here is my code : </p> <pre><code>add_filt...
[ { "answer_id": 305546, "author": "Sami", "author_id": 102593, "author_profile": "https://wordpress.stackexchange.com/users/102593", "pm_score": 0, "selected": false, "text": "<p>This seems to be the problem's root :</p>\n\n<pre><code>add_theme_support( 'title-tag' );\n</code></pre>\n\n<p...
2018/06/05
[ "https://wordpress.stackexchange.com/questions/305353", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/102593/" ]
I'm using a theme child of [Ultra Theme](https://wordpress.org/themes/ultra/). This theme is using this : ``` add_theme_support( 'title-tag' ); ``` I'd like to customize the title tag of all posts & pages, here is my code : ``` add_filter( 'wp_title', 'my_custom_title', 10, 2); function my_custom_title() { re...
When adding `title-tag` support in a theme, the title tag can be filtered by several filters, but not `wp_title`. The reason is that if the theme supports `title-tag`, WordPress uses [`wp_get_document_title()`](https://developer.wordpress.org/reference/functions/wp_get_document_title/) instead of [`wp_title()`](https:/...
305,354
<p>I am using the following hook to loop over my menu items and apply a class based on certain criteria.</p> <pre><code>add_filter( 'nav_menu_css_class', 'highlight_base_category', 1, 3 ); </code></pre> <p>The <code>nav_menu_css_class</code> filter runs for each individual menu item, but I want to completely halt the...
[ { "answer_id": 305356, "author": "Chris J Allen", "author_id": 44848, "author_profile": "https://wordpress.stackexchange.com/users/44848", "pm_score": 0, "selected": false, "text": "<p>Looks like I just remove said filter, then it'll get reattached on the next page request.</p>\n\n<pre><...
2018/06/05
[ "https://wordpress.stackexchange.com/questions/305354", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44848/" ]
I am using the following hook to loop over my menu items and apply a class based on certain criteria. ``` add_filter( 'nav_menu_css_class', 'highlight_base_category', 1, 3 ); ``` The `nav_menu_css_class` filter runs for each individual menu item, but I want to completely halt the filter once the class has been appli...
Yes, there is such way. All you need to do is to unregister your filter inside it: ``` function highlight_base_category( $classes, $item, $args ) { // most probably you have some if statement here if ( /* YOU CONDITION */ ) { // your code remove_filter( 'nav_menu_css_class', 'highlight_base_ca...
305,372
<p>Like many other, I would like to have: <em>domain.com/post-title</em> changed into <em>domain.com/blog/post-title</em> but only for the post type 'post', not for 'page' and especially not for the custom post types (of which my theme seems to have many).</p> <p>I have done my research on this forum and other sources...
[ { "answer_id": 346935, "author": "Rajilesh Panoli", "author_id": 68892, "author_profile": "https://wordpress.stackexchange.com/users/68892", "pm_score": 0, "selected": false, "text": "<p>Did you tried this?</p>\n\n<pre><code>function generate_rewrite_rules( $wp_rewrite ) {\n $new_ru...
2018/06/05
[ "https://wordpress.stackexchange.com/questions/305372", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/53991/" ]
Like many other, I would like to have: *domain.com/post-title* changed into *domain.com/blog/post-title* but only for the post type 'post', not for 'page' and especially not for the custom post types (of which my theme seems to have many). I have done my research on this forum and other sources and I know the general ...
I found the answer [here](https://wordpress.stackexchange.com/a/230313/128304). Remember to pop in there and give it a like. I'll post it here, for people in a rush. --- Put this into the `functions.php`-file: ``` function wp1482371_custom_post_type_args( $args, $post_type ) { if ( $post_type == "post" ) { $...
305,378
<p>I have a custom WordPress table using wp_list_table, with a search field: the search works well, but I am seeing that the search value isn't added to the pagination links when there are multiple pages of results. Here is my complete code:</p> <pre><code>if ( ! class_exists( 'WP_List_Table' ) ) { require_once( A...
[ { "answer_id": 306141, "author": "keithp", "author_id": 144861, "author_profile": "https://wordpress.stackexchange.com/users/144861", "pm_score": 2, "selected": false, "text": "<p>I solved my issue by passing the page variable as a hidden field:</p>\n\n<pre><code>&lt;form method=\"get\"&...
2018/06/05
[ "https://wordpress.stackexchange.com/questions/305378", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144861/" ]
I have a custom WordPress table using wp\_list\_table, with a search field: the search works well, but I am seeing that the search value isn't added to the pagination links when there are multiple pages of results. Here is my complete code: ``` if ( ! class_exists( 'WP_List_Table' ) ) { require_once( ABSPATH . 'wp...
I solved my issue by passing the page variable as a hidden field: ``` <form method="get"> <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" /> <?php $this->customers_obj->prepare_items(); $this->customers_obj->search_box('Search', 'search'); $this->customers_obj->display(); ?...
305,425
<pre><code>&lt;?php namespace wp_gdpr_wc\controller; use wp_gdpr\lib\Gdpr_Language; class Controller_Menu_Page_Wc { const PRIVACY_POLICY_TEXT_WOO_REQUEST = 'gdpr_priv_pov_text_woo_request'; const NOT_CONSENT_WOO_REQUEST = 'gdpr_not_consent_woo_request'; /** * Controller_Menu_Page constructor. ...
[ { "answer_id": 305426, "author": "kero", "author_id": 108180, "author_profile": "https://wordpress.stackexchange.com/users/108180", "pm_score": 2, "selected": false, "text": "<p>Editing other plugins' or themes' files that don't have proper hooks or filters is complicated.</p>\n\n<p>Chan...
2018/06/06
[ "https://wordpress.stackexchange.com/questions/305425", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/142375/" ]
``` <?php namespace wp_gdpr_wc\controller; use wp_gdpr\lib\Gdpr_Language; class Controller_Menu_Page_Wc { const PRIVACY_POLICY_TEXT_WOO_REQUEST = 'gdpr_priv_pov_text_woo_request'; const NOT_CONSENT_WOO_REQUEST = 'gdpr_not_consent_woo_request'; /** * Controller_Menu_Page constructor. */ pu...
There is a filter you can use, but it is well hidden. Take a look at the [WordPress function `__`](https://developer.wordpress.org/reference/functions/__/). As you can see it calls another function, [`translate`](https://developer.wordpress.org/reference/functions/translate/). And there it is, a filter called `gettext`...
305,472
<p>I basically want to add an embedded form at the end of every blog post just below the main content area (I tried adding in the footer but it gets skipped due to showing up at the very bottom of the page). Where exactly do I put the code in the editor?</p>
[ { "answer_id": 305426, "author": "kero", "author_id": 108180, "author_profile": "https://wordpress.stackexchange.com/users/108180", "pm_score": 2, "selected": false, "text": "<p>Editing other plugins' or themes' files that don't have proper hooks or filters is complicated.</p>\n\n<p>Chan...
2018/06/06
[ "https://wordpress.stackexchange.com/questions/305472", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144928/" ]
I basically want to add an embedded form at the end of every blog post just below the main content area (I tried adding in the footer but it gets skipped due to showing up at the very bottom of the page). Where exactly do I put the code in the editor?
There is a filter you can use, but it is well hidden. Take a look at the [WordPress function `__`](https://developer.wordpress.org/reference/functions/__/). As you can see it calls another function, [`translate`](https://developer.wordpress.org/reference/functions/translate/). And there it is, a filter called `gettext`...
305,488
<p>I have been trying over and over but have come up empty handed. I have followed this tutorial (<a href="https://www.atomicsmash.co.uk/blog/customising-the-woocommerce-my-account-section/" rel="nofollow noreferrer">https://www.atomicsmash.co.uk/blog/customising-the-woocommerce-my-account-section/</a>) to create a new...
[ { "answer_id": 312165, "author": "nmr", "author_id": 147428, "author_profile": "https://wordpress.stackexchange.com/users/147428", "pm_score": 0, "selected": false, "text": "<p>In your code, you have not added endpoint to query vars.</p>\n\n<p>Missing code:</p>\n\n<pre><code>function cus...
2018/06/07
[ "https://wordpress.stackexchange.com/questions/305488", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144937/" ]
I have been trying over and over but have come up empty handed. I have followed this tutorial (<https://www.atomicsmash.co.uk/blog/customising-the-woocommerce-my-account-section/>) to create a new php page for 'My accounts' menu. for some reason it will not link to the new endpoint and constantly revert to dashboard......
Try adding this code to your add\_action 'init' function. ``` // Let WooCommerce add a new custom endpoint "earnings" for you add_filter( 'woocommerce_get_query_vars', function( $vars ) { $vars['earnings'] = 'earnings'; return $vars; } ); // Add "earnings" to the WooCommerce account menu add_filter( 'woocom...
305,495
<p>I'm using Wordpress 4.9+ which I believe enabled with REST api by default. My permalinks are set to <code>Month and Name</code> And I'm using Foxhound React theme for my site.</p> <p>Now my rest api should be available in</p> <p><code>http://example.com/wp-json/wp/v2/posts</code></p> <p>But its available in </p> ...
[ { "answer_id": 305498, "author": "AA Shakil", "author_id": 135258, "author_profile": "https://wordpress.stackexchange.com/users/135258", "pm_score": 1, "selected": false, "text": "<p>You are may trying to get your url like <code>http://example.com/...../posts</code> instead of <code>http...
2018/06/07
[ "https://wordpress.stackexchange.com/questions/305495", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144940/" ]
I'm using Wordpress 4.9+ which I believe enabled with REST api by default. My permalinks are set to `Month and Name` And I'm using Foxhound React theme for my site. Now my rest api should be available in `http://example.com/wp-json/wp/v2/posts` But its available in `http://example.com/index.php/wp-json/wp/v2/posts...
You need to set the permalink structure of your website. 1. Goto **Settings > Permalink**. 2. Remove `index.php` from the *Custom Structure*. 3. Click on `Save Changes`. It re-generate your permalink structure. And you'll be able to access the posts with `http://example.com/index.php/wp-json/wp/v2/posts` **Updated:*...
305,502
<p>I have added some custom styles to the TinyMCE editor using the <code>tiny_mce_before_init</code> filter hook. They work by adding classes to the block-level element. See the code below: </p> <pre><code>function byron_mce_before_init($settings) { $style_formats = [ [ 'title' =&gt; 'Lead', ...
[ { "answer_id": 308144, "author": "Nat", "author_id": 73029, "author_profile": "https://wordpress.stackexchange.com/users/73029", "pm_score": 3, "selected": true, "text": "<p>Seems the question was asked at community.tinymce.com and the answer is here:\n<a href=\"https://community.tinymc...
2018/06/07
[ "https://wordpress.stackexchange.com/questions/305502", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/106941/" ]
I have added some custom styles to the TinyMCE editor using the `tiny_mce_before_init` filter hook. They work by adding classes to the block-level element. See the code below: ``` function byron_mce_before_init($settings) { $style_formats = [ [ 'title' => 'Lead', 'block' => 'p', ...
Seems the question was asked at community.tinymce.com and the answer is here: <https://community.tinymce.com/communityQuestion?id=90661000000IiyjAAC> You can't make the style you've defined remove any previous classes, but what you can do is 'apply' the style again by selecting it from the dropdown list and it will be...
305,521
<p>I have the following, which is successfully pulling the title, thumbnail, and custom field data (YouTube link) from a referenced post, but the content displayed is that of the parent:</p> <pre><code>function woo_videos_tab_content() { $posts = get_field('videos'); if( $posts ): ?&gt; &lt;div class="row"&gt; ...
[ { "answer_id": 305523, "author": "idpokute", "author_id": 87895, "author_profile": "https://wordpress.stackexchange.com/users/87895", "pm_score": 1, "selected": false, "text": "<p>You are using the methods with incorrect parameter.</p>\n\n<p>First of all, get_the_content function doesn't...
2018/06/07
[ "https://wordpress.stackexchange.com/questions/305521", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111367/" ]
I have the following, which is successfully pulling the title, thumbnail, and custom field data (YouTube link) from a referenced post, but the content displayed is that of the parent: ``` function woo_videos_tab_content() { $posts = get_field('videos'); if( $posts ): ?> <div class="row"> <?php foreach( $posts ...
Function [`get_the_content`](https://codex.wordpress.org/Function_Reference/get_the_content) doesn't take `post_ID` as param. It has 2 params: * `$more_link_text` - (string) (optional) Content for when there is more text. * `$stripteaser` - (boolean) (optional) Strip teaser content before the more text. So you can't ...
305,533
<p>I have a method that is hooked to the <code>rest_api_init</code></p> <pre><code> /** * Set allowed headers for the rest request */ public function set_allowed_rest_headers() { remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); add_filter( 'rest_pre_serve_request', function...
[ { "answer_id": 305537, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 1, "selected": false, "text": "<p>The question actually has nothing specific to wordpress, but maybe it is worth answering.</p>\n\n<p>There...
2018/06/07
[ "https://wordpress.stackexchange.com/questions/305533", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/58895/" ]
I have a method that is hooked to the `rest_api_init` ``` /** * Set allowed headers for the rest request */ public function set_allowed_rest_headers() { remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); add_filter( 'rest_pre_serve_request', function( $value ) { head...
The question actually has nothing specific to wordpress, but maybe it is worth answering. There is simply no code of your own in that sample that can be/is worth testing, therefor there isn't much to unit test. Lets look at the details. `add_filter` is integration with core code, `remove_filter` is integration with c...
305,547
<p>I switched my web from http to https by using "Better search and replace" and everything worked fine - at first sight.</p> <p>All resources were deliverd via https and the Firefox showed a green lock. But when now uploading a new image I saw that it will be delivered via http.</p> <p>I immediatle checked my db but...
[ { "answer_id": 305554, "author": "LuisD", "author_id": 144974, "author_profile": "https://wordpress.stackexchange.com/users/144974", "pm_score": 2, "selected": false, "text": "<p>It is possible to hardcode the value of the \"Wordpress Address (URL)\" and \"Site Address(URL)\" options wit...
2018/06/07
[ "https://wordpress.stackexchange.com/questions/305547", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116916/" ]
I switched my web from http to https by using "Better search and replace" and everything worked fine - at first sight. All resources were deliverd via https and the Firefox showed a green lock. But when now uploading a new image I saw that it will be delivered via http. I immediatle checked my db but in options/home ...
It is possible to hardcode the value of the "Wordpress Address (URL)" and "Site Address(URL)" options within your *wp-config.php* file. When the value of either field is hardcoded this way, it takes precedence over the respective value set in the database. This is why you cannot edit the field via the Wordpress Admin P...
305,574
<p>How to add Category name to post title (H1)? “PostTitle + CategoryName”?</p> <p>My <strong>h1</strong> post title code:</p> <pre><code>&lt;?php the_title( '&lt;h1 class="entry-title"&gt;', '&lt;/h1&gt;' ); ?&gt; </code></pre>
[ { "answer_id": 305554, "author": "LuisD", "author_id": 144974, "author_profile": "https://wordpress.stackexchange.com/users/144974", "pm_score": 2, "selected": false, "text": "<p>It is possible to hardcode the value of the \"Wordpress Address (URL)\" and \"Site Address(URL)\" options wit...
2018/06/07
[ "https://wordpress.stackexchange.com/questions/305574", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144992/" ]
How to add Category name to post title (H1)? “PostTitle + CategoryName”? My **h1** post title code: ``` <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> ```
It is possible to hardcode the value of the "Wordpress Address (URL)" and "Site Address(URL)" options within your *wp-config.php* file. When the value of either field is hardcoded this way, it takes precedence over the respective value set in the database. This is why you cannot edit the field via the Wordpress Admin P...
305,583
<p>I want my entire site in English, but the dates to be in another language.</p> <p>I tried to set PHP local like this:</p> <pre><code>setlocale(LC_ALL, 'he'); </code></pre> <p>Setting my whole website to another language from the admin panel does change the time language, but I don't want this. Any ideas on how to ac...
[ { "answer_id": 305736, "author": "Slam", "author_id": 82256, "author_profile": "https://wordpress.stackexchange.com/users/82256", "pm_score": 1, "selected": false, "text": "<p>It sounds like you want to create a multilingual site; even if you aren't displaying multiple languages on the a...
2018/06/08
[ "https://wordpress.stackexchange.com/questions/305583", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145001/" ]
I want my entire site in English, but the dates to be in another language. I tried to set PHP local like this: ``` setlocale(LC_ALL, 'he'); ``` Setting my whole website to another language from the admin panel does change the time language, but I don't want this. Any ideas on how to accomplish that?
It sounds like you want to create a multilingual site; even if you aren't displaying multiple languages on the admin side, it sounds like you want one language in the backend and another on the frontend. You might want to check out [WPBeginner's article on multi-language WordPress](http://www.wpbeginner.com/beginners...
305,607
<p>I have a simple Wordpress Custimizer section being added. The section shows and the controls are rendered and can be seen if you click it before it vanishes or if you stop the page load before it vanishes (Which leads me to believe it is JavaScript related). I can't figure out why?</p> <p><strong>UPDATE - The secti...
[ { "answer_id": 305593, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 0, "selected": false, "text": "<p>When i move/migrate a WP site, i usually use this handy tool:\n<a href=\"https://interconnectit.com/products/se...
2018/06/08
[ "https://wordpress.stackexchange.com/questions/305607", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115290/" ]
I have a simple Wordpress Custimizer section being added. The section shows and the controls are rendered and can be seen if you click it before it vanishes or if you stop the page load before it vanishes (Which leads me to believe it is JavaScript related). I can't figure out why? **UPDATE - The section disappears as...
When i move/migrate a WP site, i usually use this handy tool: <https://interconnectit.com/products/search-and-replace-for-wordpress-databases/> With this tool you can replace strings in the database. Upload srdb to the root and extract (example.com/srdb/\_all\_files). Then go to <http://example.com/srdb>. You shoul...
305,633
<p>I come from Drupal 8, where I am used to template files for each entity (piece of data). As far as I understood in WP every page template does look after it's own content via theming it via code that sits in the (page / post) tpl file itself.</p> <p>I believe there must be a nicer way to theme an "ACF Flexible Fiel...
[ { "answer_id": 305635, "author": "Florian", "author_id": 10595, "author_profile": "https://wordpress.stackexchange.com/users/10595", "pm_score": 1, "selected": false, "text": "<p>You can include template partials via <a href=\"https://developer.wordpress.org/reference/functions/get_templ...
2018/06/08
[ "https://wordpress.stackexchange.com/questions/305633", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145033/" ]
I come from Drupal 8, where I am used to template files for each entity (piece of data). As far as I understood in WP every page template does look after it's own content via theming it via code that sits in the (page / post) tpl file itself. I believe there must be a nicer way to theme an "ACF Flexible Field" than du...
And to add to previous answers, you can not only use `get_template_part`, but also use it's second param and combine it with ACFs `get_row_layout`. So let's say that somewhere in your template is: ``` <?php while ( have_posts() ) : the_post(); ?> <article> ... SOME CODE <?php while ( have_rows( 'YOUR_FIELD_N...
305,645
<p>I need to check the speed of a couple of WordPress pages on a few different hosts (WordPress installations on different could hosting providers and managed hosts) to determine the fastest.</p> <p>Problem is that I will gain access to the original site only when I have determined the fastest host, Then I can migrate...
[ { "answer_id": 305635, "author": "Florian", "author_id": 10595, "author_profile": "https://wordpress.stackexchange.com/users/10595", "pm_score": 1, "selected": false, "text": "<p>You can include template partials via <a href=\"https://developer.wordpress.org/reference/functions/get_templ...
2018/06/08
[ "https://wordpress.stackexchange.com/questions/305645", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145041/" ]
I need to check the speed of a couple of WordPress pages on a few different hosts (WordPress installations on different could hosting providers and managed hosts) to determine the fastest. Problem is that I will gain access to the original site only when I have determined the fastest host, Then I can migrate the site ...
And to add to previous answers, you can not only use `get_template_part`, but also use it's second param and combine it with ACFs `get_row_layout`. So let's say that somewhere in your template is: ``` <?php while ( have_posts() ) : the_post(); ?> <article> ... SOME CODE <?php while ( have_rows( 'YOUR_FIELD_N...
305,665
<p>For some custom functionality in Woocommerce, I need to copy order items with all metadata from one order to another order programatically. The source order is of type <code>WC_Order</code> while destination order type is <code>WC_Subscription</code> which extends <code>WC_Order</code> and is a custom order type.</p...
[ { "answer_id": 305693, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 0, "selected": false, "text": "<p>Ok, you need this for custom WOO functionality.</p>\n\n<p>But <code>WC_Subscription</code> is from the WOO Subs...
2018/06/08
[ "https://wordpress.stackexchange.com/questions/305665", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/140368/" ]
For some custom functionality in Woocommerce, I need to copy order items with all metadata from one order to another order programatically. The source order is of type `WC_Order` while destination order type is `WC_Subscription` which extends `WC_Order` and is a custom order type. I have tried with a following functio...
Just change the `$item_id` to `$to_order_item_id` and you don't even have to touch the `order_item_meta` since it is still associated with the proper `$item_id`. So your `foreach` from above would be ... ``` foreach($order->get_items() as $item_id=>$item) { wc_update_order_item($item_id, array('order_id'=>$to_orde...
305,695
<p>I Developed one Newspaper portal in WordPress. I am using <strong>Two languages in this portal Tamil(site language) and English</strong>.</p> <p>Now I am using <strong>Nova Sans Tamil font for Tamil language font</strong> and <strong>Roboto font For English</strong></p> <p>In Headings and Menus I can easily handle...
[ { "answer_id": 305708, "author": "Ovidiu", "author_id": 137365, "author_profile": "https://wordpress.stackexchange.com/users/137365", "pm_score": 1, "selected": false, "text": "<p>Whichever solution you use for language switching, I am sure it sets a meta tag with the language (see case ...
2018/06/09
[ "https://wordpress.stackexchange.com/questions/305695", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/140788/" ]
I Developed one Newspaper portal in WordPress. I am using **Two languages in this portal Tamil(site language) and English**. Now I am using **Nova Sans Tamil font for Tamil language font** and **Roboto font For English** In Headings and Menus I can easily handle this problem using css, but in body of the content I ca...
This question is not about WordPress but about css. Actually there even is a straightforward solution, because css-3 has an attribute called [`unicode-range`](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range), which allows you to load fonts based on the character set. For [Tamil the unicode blo...
305,697
<p>I am using this below code to remove woocommerce sidebar, from cart and single-product page. </p> <pre><code>function urun_sidebar_kaldir() { if ( is_product() || is_cart() ) { remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); } } add_action( 'woocommerce_before_main_content', '...
[ { "answer_id": 305699, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 3, "selected": true, "text": "<p>First, most themes have multiple page templates you can choose from.</p>\n\n<p>Please check:</p>\n\n<ol>\n<li>go...
2018/06/09
[ "https://wordpress.stackexchange.com/questions/305697", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133897/" ]
I am using this below code to remove woocommerce sidebar, from cart and single-product page. ``` function urun_sidebar_kaldir() { if ( is_product() || is_cart() ) { remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); } } add_action( 'woocommerce_before_main_content', 'urun_sidebar_k...
First, most themes have multiple page templates you can choose from. Please check: 1. go to cart page (in wp-admin). 2. See side metabox 'Page Attributes'. 3. There you can set the page template, does it have something like 'full\_width'? You can also try a different hook, like `wp_head`. Example: ``` add_action...
305,700
<p>I have two post types in my website. one for courses and other for teachers. I want to put a selectable list of teachers post type in courses post type and then show it in course single page and link it to single page of that teacher. how can i do?</p> <pre><code> function custom_meta_box_markup($object) { wp_no...
[ { "answer_id": 305699, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 3, "selected": true, "text": "<p>First, most themes have multiple page templates you can choose from.</p>\n\n<p>Please check:</p>\n\n<ol>\n<li>go...
2018/06/09
[ "https://wordpress.stackexchange.com/questions/305700", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145073/" ]
I have two post types in my website. one for courses and other for teachers. I want to put a selectable list of teachers post type in courses post type and then show it in course single page and link it to single page of that teacher. how can i do? ``` function custom_meta_box_markup($object) { wp_nonce_field(base...
First, most themes have multiple page templates you can choose from. Please check: 1. go to cart page (in wp-admin). 2. See side metabox 'Page Attributes'. 3. There you can set the page template, does it have something like 'full\_width'? You can also try a different hook, like `wp_head`. Example: ``` add_action...
305,706
<p>i want to add a prefix to all the blog title by modifying the all ready applied filter .</p> <p>when i searched i got this:</p> <pre><code>apply_filters( 'single_post_title', string $post_title, object $post ) </code></pre> <p>what action do i have to modify this?</p> <pre><code>add_filter('single_post_title', '...
[ { "answer_id": 305709, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 2, "selected": true, "text": "<p>With the filter <code>single_post_title</code>, you can change the page/post title that is set in the <code>&lt;...
2018/06/09
[ "https://wordpress.stackexchange.com/questions/305706", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
i want to add a prefix to all the blog title by modifying the all ready applied filter . when i searched i got this: ``` apply_filters( 'single_post_title', string $post_title, object $post ) ``` what action do i have to modify this? ``` add_filter('single_post_title', 'my_title'); function my_title() {} ``` i ...
With the filter `single_post_title`, you can change the page/post title that is set in the `<head><title>Page title</title></head>`. If you want to change the title that you see in the page header. ( Which i think you want to do). Use this filter: ``` add_filter('the_title', 'modify_all_titles', 10, 2); function mo...
305,716
<p>My client decided to take it upon himself to change his domain and but when he did that, it corrupted most of the website. I managed to fix most of it but there is one error i cannot fix. When the user clicks on a picture it loads the picture fine but the left,right, and X on top are replaced with a box as seen here...
[ { "answer_id": 305709, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 2, "selected": true, "text": "<p>With the filter <code>single_post_title</code>, you can change the page/post title that is set in the <code>&lt;...
2018/06/09
[ "https://wordpress.stackexchange.com/questions/305716", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145082/" ]
My client decided to take it upon himself to change his domain and but when he did that, it corrupted most of the website. I managed to fix most of it but there is one error i cannot fix. When the user clicks on a picture it loads the picture fine but the left,right, and X on top are replaced with a box as seen here [E...
With the filter `single_post_title`, you can change the page/post title that is set in the `<head><title>Page title</title></head>`. If you want to change the title that you see in the page header. ( Which i think you want to do). Use this filter: ``` add_filter('the_title', 'modify_all_titles', 10, 2); function mo...
305,812
<p>I am building an football news site, and on my homepage I have a list of the latest articles. Just the titles and date, no featured images etc. Very clean and simple. But I want to add an image from which category it is in front of it.</p> <p>For example, if it's news from the English football competition, there wi...
[ { "answer_id": 305709, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 2, "selected": true, "text": "<p>With the filter <code>single_post_title</code>, you can change the page/post title that is set in the <code>&lt;...
2018/06/11
[ "https://wordpress.stackexchange.com/questions/305812", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145136/" ]
I am building an football news site, and on my homepage I have a list of the latest articles. Just the titles and date, no featured images etc. Very clean and simple. But I want to add an image from which category it is in front of it. For example, if it's news from the English football competition, there will be an E...
With the filter `single_post_title`, you can change the page/post title that is set in the `<head><title>Page title</title></head>`. If you want to change the title that you see in the page header. ( Which i think you want to do). Use this filter: ``` add_filter('the_title', 'modify_all_titles', 10, 2); function mo...
305,821
<p>my .htaccess code </p> <h1>BEGIN WordPress</h1> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &lt;/IfModule&gt; # END WordPress </code></pre> <p><a href="...
[ { "answer_id": 305709, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 2, "selected": true, "text": "<p>With the filter <code>single_post_title</code>, you can change the page/post title that is set in the <code>&lt;...
2018/06/11
[ "https://wordpress.stackexchange.com/questions/305821", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/135085/" ]
my .htaccess code BEGIN WordPress =============== ``` <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress ``` [![enter image description here](https:/...
With the filter `single_post_title`, you can change the page/post title that is set in the `<head><title>Page title</title></head>`. If you want to change the title that you see in the page header. ( Which i think you want to do). Use this filter: ``` add_filter('the_title', 'modify_all_titles', 10, 2); function mo...
305,842
<p>How to get the value of ACF after clicking update user in User menu. I have the following code but it's not working:</p> <pre><code>function get_acf_value ($post_id) { $v = get_field('field_5b1d13fce338d', $post_id); echo $v; } add_action( 'acf/save_post', 'get_acf_value' ); </code></pre>
[ { "answer_id": 305853, "author": "Shibi", "author_id": 62500, "author_profile": "https://wordpress.stackexchange.com/users/62500", "pm_score": 1, "selected": false, "text": "<p>Your code is working but its not going to print to the screen anything because save_post running in ajax. You c...
2018/06/11
[ "https://wordpress.stackexchange.com/questions/305842", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/131529/" ]
How to get the value of ACF after clicking update user in User menu. I have the following code but it's not working: ``` function get_acf_value ($post_id) { $v = get_field('field_5b1d13fce338d', $post_id); echo $v; } add_action( 'acf/save_post', 'get_acf_value' ); ```
Your code is working but its not going to print to the screen anything because save\_post running in ajax. You can debug the action with the `error_log()`. First in the wp-config.php you need to turn debug and set it to log into file instead of display ``` define('WP_DEBUG', true); define('WP_DEBUG_DISPLAY', false); ...
305,882
<p>While freshly installed, I cannot access the 'Add new plugins` page whatsoever. It just keep waiting &amp; then redirect me to 404 page of the current theme.</p> <p>I'm not sure what went wrong as the wordpress is freshly installed. Wordpress version is 4.9.6 &amp; I'm using PHP7 for the host.</p> <p>I tried solut...
[ { "answer_id": 305853, "author": "Shibi", "author_id": 62500, "author_profile": "https://wordpress.stackexchange.com/users/62500", "pm_score": 1, "selected": false, "text": "<p>Your code is working but its not going to print to the screen anything because save_post running in ajax. You c...
2018/06/12
[ "https://wordpress.stackexchange.com/questions/305882", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/101948/" ]
While freshly installed, I cannot access the 'Add new plugins` page whatsoever. It just keep waiting & then redirect me to 404 page of the current theme. I'm not sure what went wrong as the wordpress is freshly installed. Wordpress version is 4.9.6 & I'm using PHP7 for the host. I tried solutions suggested for simila...
Your code is working but its not going to print to the screen anything because save\_post running in ajax. You can debug the action with the `error_log()`. First in the wp-config.php you need to turn debug and set it to log into file instead of display ``` define('WP_DEBUG', true); define('WP_DEBUG_DISPLAY', false); ...
305,894
<p>I am having a heck of a time finding an answer to this solution. I have googled everything I can think of but I can't find anything. I want to load an inline JavaScript tag in the footer of the admin. When I use the admin_footer action, the code is added <em>before</em> the JS tags that are called by the wp_enqueue_...
[ { "answer_id": 305896, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 0, "selected": false, "text": "<p>I did the following test:</p>\n\n<pre><code>add_action('admin_footer', 'admin_footer_test', PHP_INT_MAX);\nfunc...
2018/06/12
[ "https://wordpress.stackexchange.com/questions/305894", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/86835/" ]
I am having a heck of a time finding an answer to this solution. I have googled everything I can think of but I can't find anything. I want to load an inline JavaScript tag in the footer of the admin. When I use the admin\_footer action, the code is added *before* the JS tags that are called by the wp\_enqueue\_script ...
I finally found the answer. I need to use the [admin\_print\_footer\_scripts](https://make.wordpress.org/core/2016/07/15/introducing-admin_print_footer_scripts-hook_suffix-in-4-6/) action. This will add scripts after the scripts that were called with `wp_enqueue_scripts`.
305,910
<p>I have a custom post type by the name of the event.</p> <p>So Created a category page them for them like this →</p> <pre><code>category-event.php </code></pre> <p>Like this →</p> <pre><code>&lt;?php get_header(); ?&gt; //and then the loop here &lt;?php get_footer(); ?&gt; </code></pre> <p>But the individual category...
[ { "answer_id": 305912, "author": "user3135691", "author_id": 59755, "author_profile": "https://wordpress.stackexchange.com/users/59755", "pm_score": 2, "selected": false, "text": "<p>I think you need to make use of the template hierarchy. So, according to the information given of your cu...
2018/06/12
[ "https://wordpress.stackexchange.com/questions/305910", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
I have a custom post type by the name of the event. So Created a category page them for them like this → ``` category-event.php ``` Like this → ``` <?php get_header(); ?> //and then the loop here <?php get_footer(); ?> ``` But the individual category pages are not generating the posts only from those categories,...
You may alter the main query before the loop, but it's crucial to reset the main query afterwards. Otherwise you'll probably run into problems elsewhere. Disclaimer: Doing this is officially discouraged by WordPress [here](https://developer.wordpress.org/reference/functions/query_posts/). However, in my experience it ...
305,939
<p>EDIT: see solution below from @motivast. With his basic setup you can then make whatever changes you'd like to specific auto-scroll actions and relocate whichever specific notices you want. My final solution also includes hooking a blank div within the coupon form and then targeting the coupon notices there, like th...
[ { "answer_id": 305912, "author": "user3135691", "author_id": 59755, "author_profile": "https://wordpress.stackexchange.com/users/59755", "pm_score": 2, "selected": false, "text": "<p>I think you need to make use of the template hierarchy. So, according to the information given of your cu...
2018/06/12
[ "https://wordpress.stackexchange.com/questions/305939", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/73388/" ]
EDIT: see solution below from @motivast. With his basic setup you can then make whatever changes you'd like to specific auto-scroll actions and relocate whichever specific notices you want. My final solution also includes hooking a blank div within the coupon form and then targeting the coupon notices there, like this:...
You may alter the main query before the loop, but it's crucial to reset the main query afterwards. Otherwise you'll probably run into problems elsewhere. Disclaimer: Doing this is officially discouraged by WordPress [here](https://developer.wordpress.org/reference/functions/query_posts/). However, in my experience it ...
305,951
<p>Does anyone know how to put code into your theme that will only shop up on WooCommerce pages? I want to add a cart link but don't need it to shop up on the rest of the site. Thanks!</p>
[ { "answer_id": 305912, "author": "user3135691", "author_id": 59755, "author_profile": "https://wordpress.stackexchange.com/users/59755", "pm_score": 2, "selected": false, "text": "<p>I think you need to make use of the template hierarchy. So, according to the information given of your cu...
2018/06/12
[ "https://wordpress.stackexchange.com/questions/305951", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/125569/" ]
Does anyone know how to put code into your theme that will only shop up on WooCommerce pages? I want to add a cart link but don't need it to shop up on the rest of the site. Thanks!
You may alter the main query before the loop, but it's crucial to reset the main query afterwards. Otherwise you'll probably run into problems elsewhere. Disclaimer: Doing this is officially discouraged by WordPress [here](https://developer.wordpress.org/reference/functions/query_posts/). However, in my experience it ...
305,976
<p>So I am trying to edit my Search so it searches only for specific categories. I am adding this code to my <code>functions.php</code> file in child theme:</p> <pre><code>function searchcategory($query) { if ($query-&gt;is_search) { $query-&gt;set('cat','37'); } return $query; } add_filter('pre_ge...
[ { "answer_id": 305979, "author": "tera_789", "author_id": 144586, "author_profile": "https://wordpress.stackexchange.com/users/144586", "pm_score": 0, "selected": false, "text": "<p>I solved the issue. I added this same code:</p>\n\n<pre><code>function searchcategory($query) {\nif ($quer...
2018/06/13
[ "https://wordpress.stackexchange.com/questions/305976", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144586/" ]
So I am trying to edit my Search so it searches only for specific categories. I am adding this code to my `functions.php` file in child theme: ``` function searchcategory($query) { if ($query->is_search) { $query->set('cat','37'); } return $query; } add_filter('pre_get_posts','searchcategory'); ``...
This code should work OK, but... There are some problems with it. Let's break it apart and add some comments. ``` function searchcategory($query) { if ($query->is_search) { // Checking only for is_search is very risky. It will be set to true // whenever param "s" is set. So your function will modif...
306,011
<p>I need to display New Arrivals in a section of my homepage, I have created a new arrivals category and would like to display the products in this category on a page, I don't want to use the shortcode as I am writing the html &amp; php for this page.</p> <p>Any help would be appreciated, thanks.</p>
[ { "answer_id": 306013, "author": "Tim", "author_id": 118534, "author_profile": "https://wordpress.stackexchange.com/users/118534", "pm_score": 4, "selected": true, "text": "<p>you can still use a shortcode inside of php if you aren't customizing the output. see <a href=\"https://docs.woo...
2018/06/13
[ "https://wordpress.stackexchange.com/questions/306011", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145262/" ]
I need to display New Arrivals in a section of my homepage, I have created a new arrivals category and would like to display the products in this category on a page, I don't want to use the shortcode as I am writing the html & php for this page. Any help would be appreciated, thanks.
you can still use a shortcode inside of php if you aren't customizing the output. see <https://docs.woocommerce.com/document/woocommerce-shortcodes/#scenario-5-specific-categories> and <https://developer.wordpress.org/reference/functions/do_shortcode/> ``` <?php echo do_shortcode('[products category="new-arrivals"]');...
306,021
<p>I need to push js variable into php variable. AJAX url is set via wp_localize_script but it returns ERROR 400 Bad Request. functions.php is looks like </p> <pre><code>wp_localize_script( 'script-js', 'compareids_ajax', array( 'ajax_url' =&gt; admin_url('admin-ajax.php')) ); </code></pre> <p>custom.js</p> <pre><co...
[ { "answer_id": 306067, "author": "Bikash Waiba", "author_id": 121069, "author_profile": "https://wordpress.stackexchange.com/users/121069", "pm_score": 2, "selected": true, "text": "<p>First you need to to send function name as additional data as</p>\n\n<pre><code> $.ajax({\n typ...
2018/06/13
[ "https://wordpress.stackexchange.com/questions/306021", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145268/" ]
I need to push js variable into php variable. AJAX url is set via wp\_localize\_script but it returns ERROR 400 Bad Request. functions.php is looks like ``` wp_localize_script( 'script-js', 'compareids_ajax', array( 'ajax_url' => admin_url('admin-ajax.php')) ); ``` custom.js ``` var compareIDs = $(".table td inpu...
First you need to to send function name as additional data as ``` $.ajax({ type: "POST", url: compareids_ajax.ajax_url, data: { // Data object compareIDs : compareIDs, action: 'your_ajax_function' // This is required to let WordPress kn...
306,057
<p>I am adding a default WordPress Search widget through Elementor on two of my page, page X and page Y. Page X ID = 100, page Y ID = 200. I want the user to be able to search through category 37 when he is on page X, and be able to search through category 24 when he is on page Y. I wrote this code: </p> <pre><code>fu...
[ { "answer_id": 306064, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 0, "selected": false, "text": "<p>Well, let's try to understand what is your code doing...</p>\n\n<p>In this line:</p>\n\n<pre><code>if...
2018/06/14
[ "https://wordpress.stackexchange.com/questions/306057", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144586/" ]
I am adding a default WordPress Search widget through Elementor on two of my page, page X and page Y. Page X ID = 100, page Y ID = 200. I want the user to be able to search through category 37 when he is on page X, and be able to search through category 24 when he is on page Y. I wrote this code: ``` function searchc...
The answer before mine shows you the problem about `is_search()` in your code. To solve your problem, you can try to add some datas from your search form. In your WordPress you have a searchform.php, you can edit this file to add a new hidden field or use an ugly filter function like I have do here : ``` // Gives yo...
306,058
<p>How to redirect Old Post URL to new Post URL and keep Old post Comments? is it possible. can any one give me plugin to do this.</p>
[ { "answer_id": 306061, "author": "Dharmishtha Patel", "author_id": 135085, "author_profile": "https://wordpress.stackexchange.com/users/135085", "pm_score": 1, "selected": false, "text": "<p>I use is <a href=\"https://wordpress.org/plugins/redirection/\" rel=\"nofollow noreferrer\">free ...
2018/06/14
[ "https://wordpress.stackexchange.com/questions/306058", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/124340/" ]
How to redirect Old Post URL to new Post URL and keep Old post Comments? is it possible. can any one give me plugin to do this.
I use is [free redirection](https://wordpress.org/plugins/redirection/) plugin. If you are using Yoast SEO premium, redirection feature is available for you already. You can also use any other plugin if you like. The only thing you need to ensure is, it should be a 301 redirection. For this example, I’m using Redirect...
306,110
<p>I'm completely out of my league with regex stuff. I've seen a lot of examples for putting redirect code into the <code>.htaccess</code> file, but the default examples are mostly for changing away from dates. Everything else says to use the Redirection plugin, which I already use for simple 1 off redirects, but I don...
[ { "answer_id": 306061, "author": "Dharmishtha Patel", "author_id": 135085, "author_profile": "https://wordpress.stackexchange.com/users/135085", "pm_score": 1, "selected": false, "text": "<p>I use is <a href=\"https://wordpress.org/plugins/redirection/\" rel=\"nofollow noreferrer\">free ...
2018/06/14
[ "https://wordpress.stackexchange.com/questions/306110", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/19510/" ]
I'm completely out of my league with regex stuff. I've seen a lot of examples for putting redirect code into the `.htaccess` file, but the default examples are mostly for changing away from dates. Everything else says to use the Redirection plugin, which I already use for simple 1 off redirects, but I don't know the re...
I use is [free redirection](https://wordpress.org/plugins/redirection/) plugin. If you are using Yoast SEO premium, redirection feature is available for you already. You can also use any other plugin if you like. The only thing you need to ensure is, it should be a 301 redirection. For this example, I’m using Redirect...
306,168
<p><br>I am having a problem accessing my Advanced Custom Fields that I assigned to my post type.</p> <p><a href="https://i.stack.imgur.com/JuiNY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JuiNY.png" alt="enter image description here"></a></p> <p>To loop through the posts in my events types I ...
[ { "answer_id": 306061, "author": "Dharmishtha Patel", "author_id": 135085, "author_profile": "https://wordpress.stackexchange.com/users/135085", "pm_score": 1, "selected": false, "text": "<p>I use is <a href=\"https://wordpress.org/plugins/redirection/\" rel=\"nofollow noreferrer\">free ...
2018/06/15
[ "https://wordpress.stackexchange.com/questions/306168", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145360/" ]
I am having a problem accessing my Advanced Custom Fields that I assigned to my post type. [![enter image description here](https://i.stack.imgur.com/JuiNY.png)](https://i.stack.imgur.com/JuiNY.png) To loop through the posts in my events types I did this: ``` <?php $slider = get_posts( $slider = g array( '...
I use is [free redirection](https://wordpress.org/plugins/redirection/) plugin. If you are using Yoast SEO premium, redirection feature is available for you already. You can also use any other plugin if you like. The only thing you need to ensure is, it should be a 301 redirection. For this example, I’m using Redirect...
306,178
<p><strong>Update</strong> Case closed. I forgot I have a kill function in my functions.php with redirects attachment, search, author, daily archive pages to home. Deleted the part for search and works fine.</p> <p>Sorry for that, and thank you for your time and help :) </p> <p>I have a simple search form in wordpre...
[ { "answer_id": 306061, "author": "Dharmishtha Patel", "author_id": 135085, "author_profile": "https://wordpress.stackexchange.com/users/135085", "pm_score": 1, "selected": false, "text": "<p>I use is <a href=\"https://wordpress.org/plugins/redirection/\" rel=\"nofollow noreferrer\">free ...
2018/06/15
[ "https://wordpress.stackexchange.com/questions/306178", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143333/" ]
**Update** Case closed. I forgot I have a kill function in my functions.php with redirects attachment, search, author, daily archive pages to home. Deleted the part for search and works fine. Sorry for that, and thank you for your time and help :) I have a simple search form in wordpress ``` <form role="search" m...
I use is [free redirection](https://wordpress.org/plugins/redirection/) plugin. If you are using Yoast SEO premium, redirection feature is available for you already. You can also use any other plugin if you like. The only thing you need to ensure is, it should be a 301 redirection. For this example, I’m using Redirect...
306,207
<p>I am making an plugin, and inside my admin page (Which i add by <code>add_menu_page()</code> function) i call this function <code>pll_the_languages(["raw" =&gt; 1]))</code> but its return nothing,on client side its work fine. I added many languages on Polylang setting page. How can i get Polylang available languag...
[ { "answer_id": 306227, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 4, "selected": true, "text": "<p>According to <a href=\"https://polylang.wordpress.com/documentation/documentation-for-developers/funct...
2018/06/15
[ "https://wordpress.stackexchange.com/questions/306207", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145389/" ]
I am making an plugin, and inside my admin page (Which i add by `add_menu_page()` function) i call this function `pll_the_languages(["raw" => 1]))` but its return nothing,on client side its work fine. I added many languages on Polylang setting page. How can i get Polylang available languages from an admin page ?
According to [Polylangs Function Reference](https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/), `pll_the_languages` > > Displays a language switcher. > > > And most probably it uses some additional CSS/JS to work. If you want to get the list of languages and display th...
306,216
<p>I'm thinking using transients to store form messages to be showed after a form was submited and the page reload.</p> <p>My question is: if two or more user are using the same form in differents sessions, How can I get the correct transient message to the correct user?</p>
[ { "answer_id": 306227, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 4, "selected": true, "text": "<p>According to <a href=\"https://polylang.wordpress.com/documentation/documentation-for-developers/funct...
2018/06/15
[ "https://wordpress.stackexchange.com/questions/306216", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145399/" ]
I'm thinking using transients to store form messages to be showed after a form was submited and the page reload. My question is: if two or more user are using the same form in differents sessions, How can I get the correct transient message to the correct user?
According to [Polylangs Function Reference](https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/), `pll_the_languages` > > Displays a language switcher. > > > And most probably it uses some additional CSS/JS to work. If you want to get the list of languages and display th...
306,228
<p>WooCommerce settings are located at <code>wp-admin/admin.php?page=wc-settings</code> and each of the Tabs for its settings is a continuation of the URL query string (ex: <code>wp-admin/admin.php?page=wc-settings&amp;tab=products</code> for Products).</p> <p>I know how to use the <code>woocommerce_settings_tabs_arra...
[ { "answer_id": 306255, "author": "user141080", "author_id": 141080, "author_profile": "https://wordpress.stackexchange.com/users/141080", "pm_score": 2, "selected": false, "text": "<p><a href=\"https://i.stack.imgur.com/mnN0h.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.i...
2018/06/16
[ "https://wordpress.stackexchange.com/questions/306228", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37934/" ]
WooCommerce settings are located at `wp-admin/admin.php?page=wc-settings` and each of the Tabs for its settings is a continuation of the URL query string (ex: `wp-admin/admin.php?page=wc-settings&tab=products` for Products). I know how to use the `woocommerce_settings_tabs_array` hook to manipulate the tab itself, but...
[![WooCommerce settings with product tab](https://i.stack.imgur.com/mnN0h.png)](https://i.stack.imgur.com/mnN0h.png) To change this "sub navigation" you could use the WooCommerce filter "[woocommerce\_get\_sections\_products](https://docs.woocommerce.com/document/adding-a-section-to-a-settings-tab/)". The following ...
306,234
<p>This is the code:</p> <pre><code>if ($keys = get_post_custom_keys()) { foreach ((array) $keys as $key) { $keyt = trim($key); if (is_protected_meta($keyt, 'post')) { continue; } $values = array_map('trim', get_post_custom_values($key)); $value = implo...
[ { "answer_id": 306255, "author": "user141080", "author_id": 141080, "author_profile": "https://wordpress.stackexchange.com/users/141080", "pm_score": 2, "selected": false, "text": "<p><a href=\"https://i.stack.imgur.com/mnN0h.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.i...
2018/06/16
[ "https://wordpress.stackexchange.com/questions/306234", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/127706/" ]
This is the code: ``` if ($keys = get_post_custom_keys()) { foreach ((array) $keys as $key) { $keyt = trim($key); if (is_protected_meta($keyt, 'post')) { continue; } $values = array_map('trim', get_post_custom_values($key)); $value = implode($values, ',...
[![WooCommerce settings with product tab](https://i.stack.imgur.com/mnN0h.png)](https://i.stack.imgur.com/mnN0h.png) To change this "sub navigation" you could use the WooCommerce filter "[woocommerce\_get\_sections\_products](https://docs.woocommerce.com/document/adding-a-section-to-a-settings-tab/)". The following ...
306,250
<p>hi i am try this code for display featured image after first paragraph and display image title and alt attribute </p> <pre><code>add_filter('the_content', function($content) { $url = wp_get_attachment_url( get_post_thumbnail_id($post-&gt;ID) ); $img = '&lt;img src="'.$url.'" alt="" title=""/&gt;'; $content...
[ { "answer_id": 306253, "author": "mayersdesign", "author_id": 106965, "author_profile": "https://wordpress.stackexchange.com/users/106965", "pm_score": 0, "selected": false, "text": "<p>You have nothing in the code to display those values, try:</p>\n\n<pre><code>$img = '&lt;img src=\"'.$...
2018/06/16
[ "https://wordpress.stackexchange.com/questions/306250", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/114504/" ]
hi i am try this code for display featured image after first paragraph and display image title and alt attribute ``` add_filter('the_content', function($content) { $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); $img = '<img src="'.$url.'" alt="" title=""/>'; $content = preg_replace('#(<p>....
Maybe following function is what you are looking for. The important part you are looking for in the code is the line which holds the [pathinfo](https://secure.php.net/manual/en/function.pathinfo.php), which is php and not WordPress specific. There are probably several other options but as nobody responded till n...
306,251
<p>I wish to replace one string in all my WP posts (over one hundred).</p> <p>There is a "bulk edit" feature, but I do not think it covers this feature.</p> <p>I can think of downloading the database, open it with an editor and make a replace. In a GUI editor this may fail since the file is so large. If I read up on ...
[ { "answer_id": 306253, "author": "mayersdesign", "author_id": 106965, "author_profile": "https://wordpress.stackexchange.com/users/106965", "pm_score": 0, "selected": false, "text": "<p>You have nothing in the code to display those values, try:</p>\n\n<pre><code>$img = '&lt;img src=\"'.$...
2018/06/16
[ "https://wordpress.stackexchange.com/questions/306251", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144531/" ]
I wish to replace one string in all my WP posts (over one hundred). There is a "bulk edit" feature, but I do not think it covers this feature. I can think of downloading the database, open it with an editor and make a replace. In a GUI editor this may fail since the file is so large. If I read up on database structur...
Maybe following function is what you are looking for. The important part you are looking for in the code is the line which holds the [pathinfo](https://secure.php.net/manual/en/function.pathinfo.php), which is php and not WordPress specific. There are probably several other options but as nobody responded till n...
306,262
<p>i tried enqueue the bootstap with functions php</p> <pre><code>wp_enqueue_style('bootstrap4', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css'); wp_enqueue_script( 'boot1','https://code.jquery.com/jquery-3.3.1.slim.min.js'); wp_enqueue_script( 'boot2','https://cdnjs.cloudflare.com/ajax/lib...
[ { "answer_id": 306263, "author": "Bjorn", "author_id": 83707, "author_profile": "https://wordpress.stackexchange.com/users/83707", "pm_score": 1, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>function abc_load_my_scripts() {\n wp_enqueue_script( 'boot1','https://code.jquery...
2018/06/16
[ "https://wordpress.stackexchange.com/questions/306262", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
i tried enqueue the bootstap with functions php ``` wp_enqueue_style('bootstrap4', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css'); wp_enqueue_script( 'boot1','https://code.jquery.com/jquery-3.3.1.slim.min.js'); wp_enqueue_script( 'boot2','https://cdnjs.cloudflare.com/ajax/libs/popper.js/1....
You can use action hook and enqueue script and style to the site. ``` function my_scripts() { wp_enqueue_style('bootstrap4', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css'); wp_enqueue_script( 'boot1','https://code.jquery.com/jquery-3.3.1.slim.min.js', array( 'jquery' ),'',true ); ...
306,315
<p>I am trying to get the billing email of an order in woocommerce v2.5.5 However its giving me this error: </p> <pre><code>Call to undefined method WC_Order::get_billing_email() </code></pre> <p>Here is my order object : print_r($order)</p> <p><a href="https://i.stack.imgur.com/X3oGL.png" rel="nofollow noreferrer">...
[ { "answer_id": 306316, "author": "Aniruddha Gawade", "author_id": 101818, "author_profile": "https://wordpress.stackexchange.com/users/101818", "pm_score": 3, "selected": true, "text": "<p>In WC version 2.5, <code>get</code> and <code>set</code> functions are not available.\nThe paramete...
2018/06/18
[ "https://wordpress.stackexchange.com/questions/306315", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/45790/" ]
I am trying to get the billing email of an order in woocommerce v2.5.5 However its giving me this error: ``` Call to undefined method WC_Order::get_billing_email() ``` Here is my order object : print\_r($order) [![enter image description here](https://i.stack.imgur.com/X3oGL.png)](https://i.stack.imgur.com/X3oGL.p...
In WC version 2.5, `get` and `set` functions are not available. The parameters you want are public. So, you can directly access them: ``` $customer_email = $order->billing_email; $shipping_country = $order->shipping_country; ``` And so on. Please check the keys before using them.
306,346
<p>I've created a Text widget and put font-awesome icon HTML in editor Text Mode <code>&lt;i class="fab fa-facebook"&gt;&lt;/i&gt;</code> but toggling to Visual mode makes the code disappears though I can see it working on Frontend.</p>
[ { "answer_id": 306349, "author": "Harsh", "author_id": 131853, "author_profile": "https://wordpress.stackexchange.com/users/131853", "pm_score": 0, "selected": false, "text": "<p>You have used the wrong syntax. </p>\n\n<p>True syntax is <code>&lt;i class=\"fa fa-facebook\"&gt;&lt;/i&gt;<...
2018/06/18
[ "https://wordpress.stackexchange.com/questions/306346", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/142283/" ]
I've created a Text widget and put font-awesome icon HTML in editor Text Mode `<i class="fab fa-facebook"></i>` but toggling to Visual mode makes the code disappears though I can see it working on Frontend.
I think the issue is that WordPress removes empty tags from the editor. Try adding in a non-breaking space - Font Awesome should remove it so you shouldn't see any noticeable difference: ``` <i class="fab fa-facebook">&nbsp;</i> ```
306,432
<p>I'm looking to edit a custom post type's menu link in the WordPress admin - Is this possible?</p> <p>For example, currently its</p> <p><code>/wp-admin/edit.php?post_type=application</code></p> <p>and I want to update this with</p> <p><code>/wp-admin/edit.php?s&amp;post_status=all&amp;post_type=application&amp;ca...
[ { "answer_id": 306437, "author": "Elex", "author_id": 113687, "author_profile": "https://wordpress.stackexchange.com/users/113687", "pm_score": 1, "selected": false, "text": "<p>You can use the <code>admin_menu</code> hook. You will be able to loop over all menus. </p>\n\n<pre><code>add_...
2018/06/19
[ "https://wordpress.stackexchange.com/questions/306432", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145497/" ]
I'm looking to edit a custom post type's menu link in the WordPress admin - Is this possible? For example, currently its `/wp-admin/edit.php?post_type=application` and I want to update this with `/wp-admin/edit.php?s&post_status=all&post_type=application&cat=36&paged=1` Thank you for your time
You can use the `admin_menu` hook. You will be able to loop over all menus. ``` add_action( 'admin_menu', 'wpse_306432_edit_post_type_admin_menu', 11); function wpse_306432_edit_post_type_admin_menu() { global $menu; foreach($menu as $k => $v){ if($v[1] == 'edit_applications') // possibly 'edit_appli...
306,433
<p>First sorry for my bad english, i'm french. I need to make my website GDPR Friendly, so for this I use the plugin 'RGPD' who give me the possibility to check or uncheck multiples types of cookies. This plugin also give some functions to use.</p> <p>Here is what I try :</p> <pre><code> if (!is_allowed_cookie('_ga'...
[ { "answer_id": 306437, "author": "Elex", "author_id": 113687, "author_profile": "https://wordpress.stackexchange.com/users/113687", "pm_score": 1, "selected": false, "text": "<p>You can use the <code>admin_menu</code> hook. You will be able to loop over all menus. </p>\n\n<pre><code>add_...
2018/06/19
[ "https://wordpress.stackexchange.com/questions/306433", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145309/" ]
First sorry for my bad english, i'm french. I need to make my website GDPR Friendly, so for this I use the plugin 'RGPD' who give me the possibility to check or uncheck multiples types of cookies. This plugin also give some functions to use. Here is what I try : ``` if (!is_allowed_cookie('_ga')) { ?> <scri...
You can use the `admin_menu` hook. You will be able to loop over all menus. ``` add_action( 'admin_menu', 'wpse_306432_edit_post_type_admin_menu', 11); function wpse_306432_edit_post_type_admin_menu() { global $menu; foreach($menu as $k => $v){ if($v[1] == 'edit_applications') // possibly 'edit_appli...
306,445
<p>I am trying to create a custom rewrite rule for a custom post type where</p> <p><strong>This:</strong></p> <pre><code>http://test.loc/products/directory/?c=some-value </code></pre> <p>Should become <strong>this</strong>:</p> <pre><code>http://test.loc/products/directory/some-value </code></pre> <p><strong>Minim...
[ { "answer_id": 306453, "author": "GRowing", "author_id": 81897, "author_profile": "https://wordpress.stackexchange.com/users/81897", "pm_score": 2, "selected": false, "text": "<p><strong>SOLUTION:</strong></p>\n\n<p>I am answering my own question here since no responses were given and I ...
2018/06/19
[ "https://wordpress.stackexchange.com/questions/306445", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81897/" ]
I am trying to create a custom rewrite rule for a custom post type where **This:** ``` http://test.loc/products/directory/?c=some-value ``` Should become **this**: ``` http://test.loc/products/directory/some-value ``` **Minimal code:** ``` function create_post_type() { register_post_type( 'acme_product', ...
**SOLUTION:** I am answering my own question here since no responses were given and I presume this might be helpful to someone and in the mean while I found a solution.. I had to use the second version of 'add\_rewrite\_rule': ``` add_rewrite_rule( '^products/directory/?([^/]*)/?', 'index.php?post_type=acme_pro...
306,447
<p>I hate it, when plugins add their own settings like this: <a href="https://i.stack.imgur.com/1gh4c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1gh4c.png" alt="WordPress admin 1"></a></p> <p>It's cluttered and annoying. Can I somehow move them in under 'Settings':</p> <p><a href="https://i.s...
[ { "answer_id": 347000, "author": "BigG", "author_id": 174927, "author_profile": "https://wordpress.stackexchange.com/users/174927", "pm_score": 0, "selected": false, "text": "<p>For Yoast, you can easily hide it, the settings are also in the WP topbar. :)</p>\n\n<p>To hide it, use this c...
2018/06/19
[ "https://wordpress.stackexchange.com/questions/306447", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/128304/" ]
I hate it, when plugins add their own settings like this: [![WordPress admin 1](https://i.stack.imgur.com/1gh4c.png)](https://i.stack.imgur.com/1gh4c.png) It's cluttered and annoying. Can I somehow move them in under 'Settings': [![WordPress admin 2](https://i.stack.imgur.com/4hpju.png)](https://i.stack.imgur.com/4h...
You seem to be making life complicated. Here's the code you need; ``` function menu_shuffle() { remove_menu_page( 'plugin-page' ); add_submenu_page('options-general.php','Page Title', 'Menu Label','manage_options', 'plugin-page' ); }; add_action( 'admin_menu', 'menu_shuffle' ); ``` `plugin-page` can be found by...
306,458
<p>I have a form that is on the front end of my site. I'm trying to remove the "Remember me" checkbox but can't get this to work. Here is my form code. </p> <pre><code>&lt;?php $args = array( 'echo' =&gt; true, 'remember' =&gt; true, 'redirect' =&gt; ( is_ssl() ? 'htt...
[ { "answer_id": 306459, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>Look at your generated page code (or use the Inspect Element) to see what CSS class is assigned to the...
2018/06/19
[ "https://wordpress.stackexchange.com/questions/306458", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145165/" ]
I have a form that is on the front end of my site. I'm trying to remove the "Remember me" checkbox but can't get this to work. Here is my form code. ``` <?php $args = array( 'echo' => true, 'remember' => true, 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_S...
There is a `remember` argument for `wp_login_form()`. Just set it to false: ``` $args = array( 'remember' => false, ); wp_login_form( $args ); ```
306,463
<p>I need help accessing a specific term from a custom taxonomy.</p> <p>I am getting the terms with</p> <pre><code> $terms = wp_get_post_terms($post-&gt;ID, 'mytax', array("fields" =&gt; "all")); </code></pre> <p>If I <code>print_r($terms)</code> this is what I get:</p> <pre><code>Array ( [0] =&gt; WP_Term Obj...
[ { "answer_id": 306459, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>Look at your generated page code (or use the Inspect Element) to see what CSS class is assigned to the...
2018/06/19
[ "https://wordpress.stackexchange.com/questions/306463", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145115/" ]
I need help accessing a specific term from a custom taxonomy. I am getting the terms with ``` $terms = wp_get_post_terms($post->ID, 'mytax', array("fields" => "all")); ``` If I `print_r($terms)` this is what I get: ``` Array ( [0] => WP_Term Object ( [term_id] => 30 [name] => Term1 ...
There is a `remember` argument for `wp_login_form()`. Just set it to false: ``` $args = array( 'remember' => false, ); wp_login_form( $args ); ```
306,500
<p>im trying to redirect users on specific categry with this hook:</p> <pre><code>// Show app-data posts only to app users function user_redirect() { if ( is_category( 'app-data' ) ) { $url = site_url(); wp_redirect( $url ); exit(); } } add_action( 'the_post', 'user_redirect' ); </code>...
[ { "answer_id": 306502, "author": "Jignesh Patel", "author_id": 111556, "author_profile": "https://wordpress.stackexchange.com/users/111556", "pm_score": 2, "selected": false, "text": "<p>change your hook name <strong>the_post</strong> to <strong>template_redirect</strong></p>\n\n<pre><co...
2018/06/20
[ "https://wordpress.stackexchange.com/questions/306500", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/51191/" ]
im trying to redirect users on specific categry with this hook: ``` // Show app-data posts only to app users function user_redirect() { if ( is_category( 'app-data' ) ) { $url = site_url(); wp_redirect( $url ); exit(); } } add_action( 'the_post', 'user_redirect' ); ``` But its not wor...
Why it's not working? --------------------- There is one major problem with your code... You can't redirect after any html content was already sent... Such redirect will be ignored... So why is your code incorrect? Because of `the_post` hook. This hook is fired up when the object of post is set up. So usually it's in...
306,513
<p>I have two product category </p> <ol> <li>MULTILINGUAL DIGITAL MARKETING (ID 75)</li> <li>INTERNATIONAL SALES CHANNELS (ID 107)</li> </ol> <p>I want to run some code via if condition for these two category only.</p> <p>I tried using this code but it didn't worked</p> <pre><code>if( is_product_category(107 || 75...
[ { "answer_id": 306515, "author": "Bogdan Dragomir", "author_id": 145601, "author_profile": "https://wordpress.stackexchange.com/users/145601", "pm_score": 1, "selected": false, "text": "<p>Try:</p>\n\n<pre><code>if( is_product_category( 'category1-slug' ) || is_product_category( 'categor...
2018/06/20
[ "https://wordpress.stackexchange.com/questions/306513", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145599/" ]
I have two product category 1. MULTILINGUAL DIGITAL MARKETING (ID 75) 2. INTERNATIONAL SALES CHANNELS (ID 107) I want to run some code via if condition for these two category only. I tried using this code but it didn't worked ``` if( is_product_category(107 || 75) ) { $term = get_queried_object(); $parent = $te...
`is_product_category()` is to be used on woocommerce category archive pages only so first make sure that you are on category archive. instead of category number use category slug name `is_product_category('category-slug')` no need to run OR(||) condition just use `is_product_category('category-slug1','category-slug2'...
306,542
<p>How would one go about creating a gallery page which is a gallery of galleries - using a specific photo from the subgallery as a cover for the album? </p> <p>This is what I have so far.</p> <p>I have a folder on the backend built using WP Media Folder called <code>master</code>. I want the galleries page to list...
[ { "answer_id": 306648, "author": "Dan", "author_id": 145214, "author_profile": "https://wordpress.stackexchange.com/users/145214", "pm_score": 1, "selected": false, "text": "<p>I created a custom function for this, but if you want the root folder id, you can use the <code>wp cli</code> a...
2018/06/20
[ "https://wordpress.stackexchange.com/questions/306542", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145214/" ]
How would one go about creating a gallery page which is a gallery of galleries - using a specific photo from the subgallery as a cover for the album? This is what I have so far. I have a folder on the backend built using WP Media Folder called `master`. I want the galleries page to list a thumbnail for each folder i...
I created a custom function for this, but if you want the root folder id, you can use the `wp cli` and use the command `wp term list wpmf-gallery-category` to show all the gallery folders. Get the term id of the one you want to use as the root and set it to $master\_id ``` /* get_root_gallery_id(); Custom functi...
306,572
<p>I'd like to customise the recipient of a new order in WooCommerce. According to the documentation and various examples I can do this like so:</p> <pre><code>function wc_change_admin_new_order_email_recipient( $recipient, $order ) { global $woocommerce; //some code return $recipient; } add_filter('woocommer...
[ { "answer_id": 311960, "author": "Gabrielizalo", "author_id": 70221, "author_profile": "https://wordpress.stackexchange.com/users/70221", "pm_score": 2, "selected": false, "text": "<p>If you use <strong>W3 Total Cache</strong> verify this solution: <a href=\"https://web.archive.org/web/2...
2018/06/20
[ "https://wordpress.stackexchange.com/questions/306572", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80887/" ]
I'd like to customise the recipient of a new order in WooCommerce. According to the documentation and various examples I can do this like so: ``` function wc_change_admin_new_order_email_recipient( $recipient, $order ) { global $woocommerce; //some code return $recipient; } add_filter('woocommerce_email_recip...
If you use **W3 Total Cache** verify this solution: [WordPress Failed to Set Referrer Policy Response Headers – W3 Total Cache](https://web.archive.org/web/20180827171724/https://623lafayette.com/2018/05/02/wordpress-failed-to-set-referrer-policy/)
306,604
<p>I want to apply some <code>javascript</code> to my <code>header</code> and want to know what the best way to implement it is.</p> <p>here is the source that contains the javascript I'm including - <a href="https://codepen.io/kaemak/pen/mHyKa/" rel="noreferrer">https://codepen.io/kaemak/pen/mHyKa/</a></p> <p>Should...
[ { "answer_id": 306628, "author": "Swati", "author_id": 123547, "author_profile": "https://wordpress.stackexchange.com/users/123547", "pm_score": -1, "selected": false, "text": "<p>Yes, create a new JavaScript file and just call it wherever you want, I would suggest to call it under foote...
2018/06/21
[ "https://wordpress.stackexchange.com/questions/306604", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145660/" ]
I want to apply some `javascript` to my `header` and want to know what the best way to implement it is. here is the source that contains the javascript I'm including - <https://codepen.io/kaemak/pen/mHyKa/> Should I create a new `javascript` file then add it to the `child theme`, if so then I'm unsure of what to call...
You should enqueue the script in child theme's functions.php. for example if name of the js file is custom.js and if you place it under js folder in your child theme, then in functions.php you should add ``` function my_custom_scripts() { wp_enqueue_script( 'custom-js', get_stylesheet_directory_uri() . '/js/custom...
306,642
<p>I am trying to customize the notification email sent to user that contains the link to set password.</p> <p>Currently, I have set up a custom user registration and login forms at the urls <code>site.com/register</code> and <code>site.com/login</code> respectively.</p> <p>After the registration, wordpress is sendin...
[ { "answer_id": 306730, "author": "Andy Macaulay-Brook", "author_id": 94267, "author_profile": "https://wordpress.stackexchange.com/users/94267", "pm_score": 1, "selected": false, "text": "<p>You need to be able to assign the generated key to your variable <code>$key</code>, which is curr...
2018/06/21
[ "https://wordpress.stackexchange.com/questions/306642", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/66151/" ]
I am trying to customize the notification email sent to user that contains the link to set password. Currently, I have set up a custom user registration and login forms at the urls `site.com/register` and `site.com/login` respectively. After the registration, wordpress is sending email with following link that asks t...
You need to use the `get_password_reset_key` function [(see reference)](https://developer.wordpress.org/reference/functions/get_password_reset_key/) which will query the database and return the reset password key of the user. Here's a full working example: ``` add_filter( 'wp_new_user_notification_email', 'custom_wp_...
306,685
<p>I am trying to solve my https redirection from all away.I follow the all solutions form stackexchange. But still in problem so I am writing here. Problem is that https redirection is working but some url not redirect. For example . <a href="http://example.com/contact" rel="nofollow noreferrer">http://example.com/con...
[ { "answer_id": 306687, "author": "Godwin Alex Ogbonda", "author_id": 128519, "author_profile": "https://wordpress.stackexchange.com/users/128519", "pm_score": -1, "selected": false, "text": "<p>You can use <a href=\"https://wordpress.org/plugins/really-simple-ssl/\" rel=\"nofollow norefe...
2018/06/22
[ "https://wordpress.stackexchange.com/questions/306685", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145664/" ]
I am trying to solve my https redirection from all away.I follow the all solutions form stackexchange. But still in problem so I am writing here. Problem is that https redirection is working but some url not redirect. For example . <http://example.com/contact> not redirect on <http://example.com/contact>. This is my co...
Your code redirects the WordPress admin pages to use https (which will work fine), and then sets the site and WordPress addresses (which may auto redirect some pages). Note that FORCE\_SSL\_LOGIN was deprecated in WordPress version 4.0 (<https://codex.wordpress.org/Administration_Over_SSL>) You can force the whole sit...
306,695
<p>I just want to hide the footer from the homepage and the rest of the website footer should remain the same. how can i do that? here is my website <a href="http://texmex-cantina.com/" rel="nofollow noreferrer">http://texmex-cantina.com/</a> Thanks in advance.</p>
[ { "answer_id": 306687, "author": "Godwin Alex Ogbonda", "author_id": 128519, "author_profile": "https://wordpress.stackexchange.com/users/128519", "pm_score": -1, "selected": false, "text": "<p>You can use <a href=\"https://wordpress.org/plugins/really-simple-ssl/\" rel=\"nofollow norefe...
2018/06/22
[ "https://wordpress.stackexchange.com/questions/306695", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/137945/" ]
I just want to hide the footer from the homepage and the rest of the website footer should remain the same. how can i do that? here is my website <http://texmex-cantina.com/> Thanks in advance.
Your code redirects the WordPress admin pages to use https (which will work fine), and then sets the site and WordPress addresses (which may auto redirect some pages). Note that FORCE\_SSL\_LOGIN was deprecated in WordPress version 4.0 (<https://codex.wordpress.org/Administration_Over_SSL>) You can force the whole sit...