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
315,456
<p>I'm new to WordPress and have been developing a new website that will replace an old non-WordPress site. WordPress is currently installed in a subfolder whilst I've been creating the new site and it's now ready to go live. (Just to point out, it's a static website without any of the blog stuff going on).</p> <p>The...
[ { "answer_id": 315393, "author": "realloc", "author_id": 6972, "author_profile": "https://wordpress.stackexchange.com/users/6972", "pm_score": 0, "selected": false, "text": "<p>Yoast's SEO plugin has a <a href=\"https://yoast.com/wordpress/plugins/seo/api/\" rel=\"nofollow noreferrer\">n...
2018/09/28
[ "https://wordpress.stackexchange.com/questions/315456", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151091/" ]
I'm new to WordPress and have been developing a new website that will replace an old non-WordPress site. WordPress is currently installed in a subfolder whilst I've been creating the new site and it's now ready to go live. (Just to point out, it's a static website without any of the blog stuff going on). There are two...
Basically this is the answer I was looking for from this question: ``` function yoastVariableToTitle( $post_id ) { $yoast_title = get_post_meta( $post_id, '_yoast_wpseo_title', true ); $title = strstr( $yoast_title, '%%', true ); if ( empty( $title ) ) { $title = get_the_title( $post_id ); ...
315,485
<p>I am trying to enable revisions for an existing custom post type. As the post type was already created about 2 years ago so where the post type was register I added <code>revisions</code> to the <code>supports</code> array.</p> <p>Earlier my code was like:</p> <pre><code> $labels = array( 'name' =&gt; 'Produ...
[ { "answer_id": 315393, "author": "realloc", "author_id": 6972, "author_profile": "https://wordpress.stackexchange.com/users/6972", "pm_score": 0, "selected": false, "text": "<p>Yoast's SEO plugin has a <a href=\"https://yoast.com/wordpress/plugins/seo/api/\" rel=\"nofollow noreferrer\">n...
2018/09/29
[ "https://wordpress.stackexchange.com/questions/315485", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/126701/" ]
I am trying to enable revisions for an existing custom post type. As the post type was already created about 2 years ago so where the post type was register I added `revisions` to the `supports` array. Earlier my code was like: ``` $labels = array( 'name' => 'Products', 'singular_name' => 'Product', 'a...
Basically this is the answer I was looking for from this question: ``` function yoastVariableToTitle( $post_id ) { $yoast_title = get_post_meta( $post_id, '_yoast_wpseo_title', true ); $title = strstr( $yoast_title, '%%', true ); if ( empty( $title ) ) { $title = get_the_title( $post_id ); ...
315,490
<p>So I had previously tested a specific redirect where I knew the page exists. </p> <pre><code>function nepal_template_redirect() { if ( is_category( 'nepal' ) ) { $url = site_url( '/nepal' ); wp_safe_redirect( $url, 301 ); exit(); } } add_action( 'template_redirect', 'nepal_template_r...
[ { "answer_id": 315499, "author": "Hans", "author_id": 129367, "author_profile": "https://wordpress.stackexchange.com/users/129367", "pm_score": 1, "selected": false, "text": "<p><code>get_page_by_path</code> does something similar:</p>\n\n<pre><code>function pagefromcat_template_redirect...
2018/09/29
[ "https://wordpress.stackexchange.com/questions/315490", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/69236/" ]
So I had previously tested a specific redirect where I knew the page exists. ``` function nepal_template_redirect() { if ( is_category( 'nepal' ) ) { $url = site_url( '/nepal' ); wp_safe_redirect( $url, 301 ); exit(); } } add_action( 'template_redirect', 'nepal_template_redirect' ); `...
Seems like I have it now. Largely due to @Michael - it requires of course that a category is exactly the same as a Page Title, but that is exactly what I want. function pagefromcat\_template\_redirect() { if ( ! is\_category() ) { return; } ``` $category = get_queried_object(); // $page = get_page_by_path( $catego...
315,511
<p>As we know by the provided API from Gutenberg we can create a custom block as</p> <pre><code>const { registerBlockType } = wp.blocks; registerBlockType( 'my-namespace/my-block', { }) </code></pre> <p>but how do I create a wrapper(category like layout) around my custom blocks in gutenberg editor? Let's say I want...
[ { "answer_id": 315563, "author": "fefe", "author_id": 23759, "author_profile": "https://wordpress.stackexchange.com/users/23759", "pm_score": 5, "selected": true, "text": "<p>Digging myself deeper in documentation, I got the following result.</p>\n<p>There is a way to group your custom b...
2018/09/29
[ "https://wordpress.stackexchange.com/questions/315511", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/23759/" ]
As we know by the provided API from Gutenberg we can create a custom block as ``` const { registerBlockType } = wp.blocks; registerBlockType( 'my-namespace/my-block', { }) ``` but how do I create a wrapper(category like layout) around my custom blocks in gutenberg editor? Let's say I want to have a collector for m...
Digging myself deeper in documentation, I got the following result. There is a way to group your custom blocks around a given category in Gutenberg, and therefore we have the method [`block_categories_all`](https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/#block_categories_all). So w...
315,576
<p>I am trying to copy an image uploaded using Contact Form 7 to the uploads directory but this only produces an empty jpeg file with 0644 permissions even though the dev directory and the uploads directory have 777 permissions while I try to solve the problem.</p> <p>I have had this particular set-up working, at leas...
[ { "answer_id": 315588, "author": "Electron", "author_id": 148986, "author_profile": "https://wordpress.stackexchange.com/users/148986", "pm_score": 0, "selected": false, "text": "<h2>Use The WordPress UI to Upload Images</h2>\n\n<p>When images are copied into a WordPress directory outsid...
2018/09/30
[ "https://wordpress.stackexchange.com/questions/315576", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133963/" ]
I am trying to copy an image uploaded using Contact Form 7 to the uploads directory but this only produces an empty jpeg file with 0644 permissions even though the dev directory and the uploads directory have 777 permissions while I try to solve the problem. I have had this particular set-up working, at least with the...
Since i was also looking for some sort of keeping submitted images, i found this simple plugin, which gave me a bit insight: <https://wordpress.org/plugins/store-file-uploads-for-contact-form-7/> Also if you read a bit on the mentioned "file-uploading-and-attachment" topic in cf7, you should get the point: > > For s...
315,582
<p>I'd like to know if I can remove the limit on the posts_per_page for a specific post type. </p> <p>In the archive.php page I'm displaying different post type, and for the specific "publications" post type I want to display all the posts. How can I achieve this without impacting the traditional "post" type? </p>
[ { "answer_id": 315585, "author": "FFrewin", "author_id": 43534, "author_profile": "https://wordpress.stackexchange.com/users/43534", "pm_score": 4, "selected": true, "text": "<p>You can hook into the <code>pre_get_posts</code> action, to access the <code>$query</code> object.</p>\n\n<p>Y...
2018/10/01
[ "https://wordpress.stackexchange.com/questions/315582", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151550/" ]
I'd like to know if I can remove the limit on the posts\_per\_page for a specific post type. In the archive.php page I'm displaying different post type, and for the specific "publications" post type I want to display all the posts. How can I achieve this without impacting the traditional "post" type?
You can hook into the `pre_get_posts` action, to access the `$query` object. You should use your action hook inside your functions.php. An example of what your function could look like: ``` add_action( 'pre_get_posts', 'publications_archive_query' ); function publications_archive_query( $query ) { if ( !is_admin() ...
315,603
<p>I would like to add an extra row to the Cart Table in Woommerce, but I can't find the right action. </p> <p>From this file <a href="https://github.com/woocommerce/woocommerce/blob/master/templates/cart/cart.php" rel="nofollow noreferrer">https://github.com/woocommerce/woocommerce/blob/master/templates/cart/cart.php...
[ { "answer_id": 315610, "author": "VinothRaja", "author_id": 146008, "author_profile": "https://wordpress.stackexchange.com/users/146008", "pm_score": 0, "selected": false, "text": "<p>try this below hook</p>\n\n<pre><code>function custom_cart_function(){\n\n echo 'demo';\n}\n\nadd_ac...
2018/10/01
[ "https://wordpress.stackexchange.com/questions/315603", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50432/" ]
I would like to add an extra row to the Cart Table in Woommerce, but I can't find the right action. From this file <https://github.com/woocommerce/woocommerce/blob/master/templates/cart/cart.php>, I would expect the 'woocommerce\_after\_cart\_contents' action to be the right one (line 149), but it prints the content ...
You already have the right "action", which is `woocommerce_after_cart_contents`. But when I tried the markup you used: ``` function quality_certificates(){ echo '<tr>TEST</tr>'; } ``` this was the visual output: *(I actually initially tested with the Twenty Seventeen theme; sorry about that. But this one is tes...
315,611
<p>I've integrated wordpress to my website with the help of godaddy. I can access my blog via a sub domain. The them of this blog however is completely different to the rest of the site.</p> <p>Am I right in saying that I need the html and css of that file to match the rest of the my site? What's the easiest way of go...
[ { "answer_id": 315610, "author": "VinothRaja", "author_id": 146008, "author_profile": "https://wordpress.stackexchange.com/users/146008", "pm_score": 0, "selected": false, "text": "<p>try this below hook</p>\n\n<pre><code>function custom_cart_function(){\n\n echo 'demo';\n}\n\nadd_ac...
2018/10/01
[ "https://wordpress.stackexchange.com/questions/315611", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151573/" ]
I've integrated wordpress to my website with the help of godaddy. I can access my blog via a sub domain. The them of this blog however is completely different to the rest of the site. Am I right in saying that I need the html and css of that file to match the rest of the my site? What's the easiest way of going about ...
You already have the right "action", which is `woocommerce_after_cart_contents`. But when I tried the markup you used: ``` function quality_certificates(){ echo '<tr>TEST</tr>'; } ``` this was the visual output: *(I actually initially tested with the Twenty Seventeen theme; sorry about that. But this one is tes...
315,637
<p>I have an issue in my custom theme. </p> <p>Direct media library upload saving in wrong month date folder (2017/03) when current date is 2018/09. But when I upload images through post it goes to the correct folder.</p> <p>I have tested in default theme, Direct media library upload goes to the correct folder. So th...
[ { "answer_id": 315610, "author": "VinothRaja", "author_id": 146008, "author_profile": "https://wordpress.stackexchange.com/users/146008", "pm_score": 0, "selected": false, "text": "<p>try this below hook</p>\n\n<pre><code>function custom_cart_function(){\n\n echo 'demo';\n}\n\nadd_ac...
2018/10/01
[ "https://wordpress.stackexchange.com/questions/315637", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116707/" ]
I have an issue in my custom theme. Direct media library upload saving in wrong month date folder (2017/03) when current date is 2018/09. But when I upload images through post it goes to the correct folder. I have tested in default theme, Direct media library upload goes to the correct folder. So the issue is in my ...
You already have the right "action", which is `woocommerce_after_cart_contents`. But when I tried the markup you used: ``` function quality_certificates(){ echo '<tr>TEST</tr>'; } ``` this was the visual output: *(I actually initially tested with the Twenty Seventeen theme; sorry about that. But this one is tes...
315,669
<p>I'm working on a WordPress site for my condo association. I would like to have two email aliases:</p> <p>residents@mycondoplace.net</p> <p>board@mycondoplace.net</p> <p>that alias to all residents, and the board members respectively. Is there a WordPress plugin that would enable this functionality? Or some other ...
[ { "answer_id": 315610, "author": "VinothRaja", "author_id": 146008, "author_profile": "https://wordpress.stackexchange.com/users/146008", "pm_score": 0, "selected": false, "text": "<p>try this below hook</p>\n\n<pre><code>function custom_cart_function(){\n\n echo 'demo';\n}\n\nadd_ac...
2018/10/01
[ "https://wordpress.stackexchange.com/questions/315669", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151609/" ]
I'm working on a WordPress site for my condo association. I would like to have two email aliases: residents@mycondoplace.net board@mycondoplace.net that alias to all residents, and the board members respectively. Is there a WordPress plugin that would enable this functionality? Or some other service? The domain name...
You already have the right "action", which is `woocommerce_after_cart_contents`. But when I tried the markup you used: ``` function quality_certificates(){ echo '<tr>TEST</tr>'; } ``` this was the visual output: *(I actually initially tested with the Twenty Seventeen theme; sorry about that. But this one is tes...
315,677
<p>I'm working on a custom Gutenberg block. I have used <code>&lt;PanelBody&gt;</code> <code>&lt;BaseControl&gt;</code> and <code>&lt;ColorPalette&gt;</code> to create some custom color pickers, however, it seems like it would be more efficient to use the built-in <code>&lt;PanelColorSettings&gt;</code> component. </p>...
[ { "answer_id": 315692, "author": "Ashiquzzaman Kiron", "author_id": 78505, "author_profile": "https://wordpress.stackexchange.com/users/78505", "pm_score": 5, "selected": true, "text": "<p>First you need to import the component - </p>\n\n<pre><code>const {\n PanelColorSettings,\n} = w...
2018/10/01
[ "https://wordpress.stackexchange.com/questions/315677", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/66722/" ]
I'm working on a custom Gutenberg block. I have used `<PanelBody>` `<BaseControl>` and `<ColorPalette>` to create some custom color pickers, however, it seems like it would be more efficient to use the built-in `<PanelColorSettings>` component. Has anyone used `<PanelColorSettings>` component in a custom block? The o...
First you need to import the component - ``` const { PanelColorSettings, } = wp.editor; ``` then inside the **InspectorControls** you call the component ``` <PanelColorSettings title={ __( 'Color Settings' ) } colorSettings={ [ { ...
315,685
<p>I am trying to crop a 1000 x 648 image to 400 x 400. I use this code in functions.php</p> <pre><code>add_theme_support( 'post-thumbnails' ); add_image_size('shop-size', 400, 400, array(center,center) ); add_image_size('shop-size2', 401, 400, true ); </code></pre> <p>then i go to the regenerate plugin and run it. ...
[ { "answer_id": 315692, "author": "Ashiquzzaman Kiron", "author_id": 78505, "author_profile": "https://wordpress.stackexchange.com/users/78505", "pm_score": 5, "selected": true, "text": "<p>First you need to import the component - </p>\n\n<pre><code>const {\n PanelColorSettings,\n} = w...
2018/10/02
[ "https://wordpress.stackexchange.com/questions/315685", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145464/" ]
I am trying to crop a 1000 x 648 image to 400 x 400. I use this code in functions.php ``` add_theme_support( 'post-thumbnails' ); add_image_size('shop-size', 400, 400, array(center,center) ); add_image_size('shop-size2', 401, 400, true ); ``` then i go to the regenerate plugin and run it. While I run it I open up wp...
First you need to import the component - ``` const { PanelColorSettings, } = wp.editor; ``` then inside the **InspectorControls** you call the component ``` <PanelColorSettings title={ __( 'Color Settings' ) } colorSettings={ [ { ...
315,702
<p>I have Menu created by wp_nav_menu. Inside it, I want to set dynamic_sidebar but wp_nav_menu instead of displaying the content, throws 1. </p> <p>Have everyone some tips for display sidebar inside wp_nav_menu? I have to add dynamic_sidebar inside menu it's important.</p> <p>Inside walker I placed the code: </p> ...
[ { "answer_id": 315703, "author": "Pratik Patel", "author_id": 143123, "author_profile": "https://wordpress.stackexchange.com/users/143123", "pm_score": -1, "selected": true, "text": "<p>You can add extra items in menu like</p>\n\n<pre><code>add_filter( 'wp_nav_menu_items', 'your_custom_m...
2018/10/02
[ "https://wordpress.stackexchange.com/questions/315702", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151639/" ]
I have Menu created by wp\_nav\_menu. Inside it, I want to set dynamic\_sidebar but wp\_nav\_menu instead of displaying the content, throws 1. Have everyone some tips for display sidebar inside wp\_nav\_menu? I have to add dynamic\_sidebar inside menu it's important. Inside walker I placed the code: ``` $item_ou...
You can add extra items in menu like ``` add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 ); function your_custom_menu_item ( $items, $args ) { if ($args->theme_location == '[YOUR-MENU-LOCATION]') { $items .= '--YOUR EXTRA STUFF HERE--'; } return $items; } ``` Hope it will help!
315,721
<p>Because of a project I need help from you. I've searched a lot but I can't find a solution. I'm trying to edit a WooCommerce function named</p> <ul> <li><blockquote> <p>woocommerce_account_orders</p> </blockquote></li> </ul> <hr> <p>I've added the field</p> <ul> <li><blockquote> <p>mycustom_id</p> </blockquo...
[ { "answer_id": 336434, "author": "Scotty G", "author_id": 166793, "author_profile": "https://wordpress.stackexchange.com/users/166793", "pm_score": 0, "selected": false, "text": "<p>You would add the <code>meta_query</code> portion to your <code>wc_get_orders()</code> as the only filter ...
2018/10/02
[ "https://wordpress.stackexchange.com/questions/315721", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151233/" ]
Because of a project I need help from you. I've searched a lot but I can't find a solution. I'm trying to edit a WooCommerce function named * > > woocommerce\_account\_orders > > > --- I've added the field * > > mycustom\_id > > > to the the orders meta-data object because I need to get all orders which has ...
I know this is very old but I would just like to share the solution. Apparently, WooCommerce is ignoring the meta\_query parameter. What you should do is something like: ``` function woocommerce_account_orders( $current_page ) { $current_page = empty( $current_page ) ? 1 : absint( $current_page ); $custome...
315,728
<p>I am having trouble adding custom column to Woocommerce Subscription.</p> <p>My codes are as below:</p> <pre><code>add_filter( 'manage_shop_subscription_posts_columns', function ($columns) { $columns['my_field'] = __('My Field'); return $columns; }, 10); </code></pre> <p>What could be wrong with my code?...
[ { "answer_id": 336434, "author": "Scotty G", "author_id": 166793, "author_profile": "https://wordpress.stackexchange.com/users/166793", "pm_score": 0, "selected": false, "text": "<p>You would add the <code>meta_query</code> portion to your <code>wc_get_orders()</code> as the only filter ...
2018/10/02
[ "https://wordpress.stackexchange.com/questions/315728", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48410/" ]
I am having trouble adding custom column to Woocommerce Subscription. My codes are as below: ``` add_filter( 'manage_shop_subscription_posts_columns', function ($columns) { $columns['my_field'] = __('My Field'); return $columns; }, 10); ``` What could be wrong with my code? I fail to understand why it is n...
I know this is very old but I would just like to share the solution. Apparently, WooCommerce is ignoring the meta\_query parameter. What you should do is something like: ``` function woocommerce_account_orders( $current_page ) { $current_page = empty( $current_page ) ? 1 : absint( $current_page ); $custome...
315,773
<p>I want to redirect all subcategories who belong to the category named symptoms to a same page.</p> <p>I did this:</p> <pre><code>RewriteRule ^category/symptoms/(.*)$ https://my-site/com/list/$1 [L,R=301] </code></pre> <p>Wordpress redirects but always add the subcategory at the end. For example: <code>my-site/com...
[ { "answer_id": 315762, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 4, "selected": true, "text": "<p>WordPress only looks for the default template files while loading the child theme. So does woocommerce.</p>\...
2018/10/03
[ "https://wordpress.stackexchange.com/questions/315773", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151695/" ]
I want to redirect all subcategories who belong to the category named symptoms to a same page. I did this: ``` RewriteRule ^category/symptoms/(.*)$ https://my-site/com/list/$1 [L,R=301] ``` Wordpress redirects but always add the subcategory at the end. For example: `my-site/com/category/symptoms/fever` is redirecte...
WordPress only looks for the default template files while loading the child theme. So does woocommerce. Any extra folder or file that exists in your parent theme **can not** be overridden, unless the developer is using actions and filters that allows you to hook into them. Therefore, a simple `require()` or `include()...
315,841
<p>I have a meta field called <code>postexpiry</code>, and I want to set the value to the publish date, + 2 weeks. So if today were October 3rd, I want the field to be set to October 17th.</p> <p>I was thinking about creating a hook to the <code>publish_post</code> filter, but I am not sure how to add 2 weeks on to <c...
[ { "answer_id": 315798, "author": "Prem Gupta", "author_id": 151576, "author_profile": "https://wordpress.stackexchange.com/users/151576", "pm_score": -1, "selected": false, "text": "<p>Child theme is a WordPress theme that inherits its functionality from another WordPress theme, the pare...
2018/10/03
[ "https://wordpress.stackexchange.com/questions/315841", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151735/" ]
I have a meta field called `postexpiry`, and I want to set the value to the publish date, + 2 weeks. So if today were October 3rd, I want the field to be set to October 17th. I was thinking about creating a hook to the `publish_post` filter, but I am not sure how to add 2 weeks on to `get_the_date()`. I know with ph...
hopefully I'm understanding correctly, if not, please explain. Usually, with a child theme, it's inheriting the functionality of the parent theme, so that means you should be able to use the parent theme's page builder. I would copy the extra lines of css you added into an external file for safekeeping, as, with some...
315,843
<p>I want to get all products of category by category name (slug). Сategory has no parents or children. I wrote my code according to <a href="https://wordpress.stackexchange.com/a/67266/86327">this answer</a>. My code:</p> <pre><code>&lt;?php $args = [ 'post_type' =&gt; 'product', 'posts_per_page' =&gt; -1, ...
[ { "answer_id": 315798, "author": "Prem Gupta", "author_id": 151576, "author_profile": "https://wordpress.stackexchange.com/users/151576", "pm_score": -1, "selected": false, "text": "<p>Child theme is a WordPress theme that inherits its functionality from another WordPress theme, the pare...
2018/10/03
[ "https://wordpress.stackexchange.com/questions/315843", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/86327/" ]
I want to get all products of category by category name (slug). Сategory has no parents or children. I wrote my code according to [this answer](https://wordpress.stackexchange.com/a/67266/86327). My code: ``` <?php $args = [ 'post_type' => 'product', 'posts_per_page' => -1, 'product_cat' => 'pyvo-v-pliash...
hopefully I'm understanding correctly, if not, please explain. Usually, with a child theme, it's inheriting the functionality of the parent theme, so that means you should be able to use the parent theme's page builder. I would copy the extra lines of css you added into an external file for safekeeping, as, with some...
315,850
<p>I'm trying to display the last 10 posts only on the home without wp creating /page/2, /page/3, archives.</p> <p>I've been testing and it seems if you disable pagination it will just grab everything crashing the server. (Don't do this at home).</p> <pre><code>if ( !is_admin() &amp;&amp; $query-&gt;is_home() &amp;&a...
[ { "answer_id": 315851, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>The <code>nopaging</code> parameter is used to show all posts or use pagination (<a href=\"https://codex.wordpres...
2018/10/03
[ "https://wordpress.stackexchange.com/questions/315850", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/77283/" ]
I'm trying to display the last 10 posts only on the home without wp creating /page/2, /page/3, archives. I've been testing and it seems if you disable pagination it will just grab everything crashing the server. (Don't do this at home). ``` if ( !is_admin() && $query->is_home() && $query->is_main_query() ) { $que...
This is a mistake it will retrieve of posts: ``` $query->set( 'nopaging' , true ); ``` What you should do instead is: ``` if ( !is_admin() && $query->is_home() && $query->is_main_query() ) { $query->set( 'posts_per_page', 10 ); $query->set( 'paged', '1'); // Makes /page/2/, etc links redirect to home ...
315,881
<p>when tried to upload a theme,got this error.</p> <p>how can i solve this? Installing Theme from uploaded file: resume.zip Unpacking the package…</p> <p>Installing the theme…<br></p> <p>The package could not be installed. The theme is missing the style.css stylesheet.</p> <p>can i know why this issue happened?</p...
[ { "answer_id": 315882, "author": "Remzi Cavdar", "author_id": 149484, "author_profile": "https://wordpress.stackexchange.com/users/149484", "pm_score": 1, "selected": false, "text": "<p>The theme package is missing an important theme file (<strong>style.css</strong>), which is required.\...
2018/10/04
[ "https://wordpress.stackexchange.com/questions/315881", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/148447/" ]
when tried to upload a theme,got this error. how can i solve this? Installing Theme from uploaded file: resume.zip Unpacking the package… Installing the theme… The package could not be installed. The theme is missing the style.css stylesheet. can i know why this issue happened? > > Theme installation failed. > ...
The key part from the error is: > > The theme is missing the style.css stylesheet. > > > WordPress docs on [Main Stylesheet](https://developer.wordpress.org/themes/basics/main-stylesheet-style-css/) says: > > In order for WordPress to recognize the set of theme template files as a valid theme, the style.css fil...
315,947
<p>I'm trying to set up an SMTP gmail server to send emails from my WordPress site. This is what I've got in my <code>wp-config.php</code>: </p> <pre><code>define( 'SMTP_USER', 'myaddress@gmail.com' ); // Username to use for SMTP authentication define( 'SMTP_PASS', 'password' ); // Password to use for SMT...
[ { "answer_id": 317636, "author": "Friss", "author_id": 62392, "author_profile": "https://wordpress.stackexchange.com/users/62392", "pm_score": 0, "selected": false, "text": "<p>Did you try to check in your Google account the option \"access for less secure app\"?\nAllow it and retry it, ...
2018/10/05
[ "https://wordpress.stackexchange.com/questions/315947", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/147485/" ]
I'm trying to set up an SMTP gmail server to send emails from my WordPress site. This is what I've got in my `wp-config.php`: ``` define( 'SMTP_USER', 'myaddress@gmail.com' ); // Username to use for SMTP authentication define( 'SMTP_PASS', 'password' ); // Password to use for SMTP authentication define( ...
Quite likely you're using the wrong encryption/port combination. You are using port 465 for tls. Port 465 should be used for SSL Port 587 should be used for TLS
316,050
<p>I've overwritten WooCommerce's <code>review-order.php</code> to change the checkout a little bit. Now everytime I add something to the hook <code>woocommerce_review_order_after_order_total</code> the contents get displayed twice and before the whole block and NOT AFTER the order total:</p> <pre><code>function outpu...
[ { "answer_id": 316062, "author": "Antonio", "author_id": 78763, "author_profile": "https://wordpress.stackexchange.com/users/78763", "pm_score": 0, "selected": false, "text": "<p>Probably if you check again the file <code>review-order.php</code> you will see that you replace the hook <co...
2018/10/06
[ "https://wordpress.stackexchange.com/questions/316050", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/149002/" ]
I've overwritten WooCommerce's `review-order.php` to change the checkout a little bit. Now everytime I add something to the hook `woocommerce_review_order_after_order_total` the contents get displayed twice and before the whole block and NOT AFTER the order total: ``` function output_payment_button() { $order_butt...
In case it helps anyone, the do\_action('woocommerce\_review\_order\_after\_order\_total') is called in the middle of a table in the template and expects a table row to be echoed by the add\_action hook. If you just echo text or, as in the question, an input, it falls outside the table, appears before not after the tab...
316,123
<p>I have a home/static page with login button. Currently I've set the button url as "<a href="http://example.com/login" rel="nofollow noreferrer">http://example.com/login</a>"</p> <p>How can I set the login button to redirect to a specific page IF/WHEN the user is logged in?</p> <p>I do not know much about coding. I...
[ { "answer_id": 316125, "author": "Vinit Soni", "author_id": 151006, "author_profile": "https://wordpress.stackexchange.com/users/151006", "pm_score": 0, "selected": false, "text": "<p>Okay so you are asking if user logged in then redirect to other pages or something like this. It's WordP...
2018/10/08
[ "https://wordpress.stackexchange.com/questions/316123", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151961/" ]
I have a home/static page with login button. Currently I've set the button url as "<http://example.com/login>" How can I set the login button to redirect to a specific page IF/WHEN the user is logged in? I do not know much about coding. I found some solution about add\_action or something and added to theme's functio...
Add below code in your **functions.php** file of active theme directory in order to restrict the login page to logged-in users and redirect them to core user page (user profile). You can replace **"um\_get\_core\_page( 'user' )"** with any page URL where you want to redirect logged-in users. ``` /* Restrict Login page...
316,126
<p>i use the following code in my functions php to reach a download after contact form 7 submission. but it is not working</p> <pre><code>//contact form 7 Download white paper// add_action( 'wp_footer', 'redirect_cf7' ); function redirect_cf7() { ?&gt; &lt;script type="text/javascript"&gt; document.addEventListener(...
[ { "answer_id": 316131, "author": "Karun", "author_id": 63470, "author_profile": "https://wordpress.stackexchange.com/users/63470", "pm_score": 1, "selected": false, "text": "<p>Try the following and replace [DOMAIN] by your own domain.</p>\n\n<pre><code>//contact form 7 Download white pa...
2018/10/08
[ "https://wordpress.stackexchange.com/questions/316126", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82174/" ]
i use the following code in my functions php to reach a download after contact form 7 submission. but it is not working ``` //contact form 7 Download white paper// add_action( 'wp_footer', 'redirect_cf7' ); function redirect_cf7() { ?> <script type="text/javascript"> document.addEventListener( 'wpcf7mailsent', funct...
Try the following and replace [DOMAIN] by your own domain. ``` //contact form 7 Download white paper// add_action( 'wp_footer', 'redirect_cf7' ); function redirect_cf7() { ?> <script type="text/javascript"> document.addEventListener( 'wpcf7mailsent', function( event ) { if ( '4265' == even...
316,187
<p>Having successfully uploaded an SVG image through WordPress's back-end media uploader with the help of a third party plugin such as Safe SVG by Daryll Doyle, how can one get the image's dimensions that are stored in the SVG file's <code>width</code>, <code>height</code>, or <code>viewBox</code> attributes to use in ...
[ { "answer_id": 316270, "author": "Trisha", "author_id": 56458, "author_profile": "https://wordpress.stackexchange.com/users/56458", "pm_score": 2, "selected": false, "text": "<p>I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attach...
2018/10/08
[ "https://wordpress.stackexchange.com/questions/316187", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/140129/" ]
Having successfully uploaded an SVG image through WordPress's back-end media uploader with the help of a third party plugin such as Safe SVG by Daryll Doyle, how can one get the image's dimensions that are stored in the SVG file's `width`, `height`, or `viewBox` attributes to use in front-end with WordPress functions s...
I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attachment attributes using, as you suggested, wp\_get\_attachment\_image\_src. Those dimensions are actually already recorded and stored when using the WP media uploader, it's likely that the plugin you're using ma...
316,195
<p>I've done a bunch of searching but can't seem to find a hack to do this, all I can find is how to remove the website field from the form. I want to leave it there, but if someone enters a url into the website field and tries to post a comment, it will automatically be rejected.</p>
[ { "answer_id": 316270, "author": "Trisha", "author_id": 56458, "author_profile": "https://wordpress.stackexchange.com/users/56458", "pm_score": 2, "selected": false, "text": "<p>I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attach...
2018/10/08
[ "https://wordpress.stackexchange.com/questions/316195", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152013/" ]
I've done a bunch of searching but can't seem to find a hack to do this, all I can find is how to remove the website field from the form. I want to leave it there, but if someone enters a url into the website field and tries to post a comment, it will automatically be rejected.
I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attachment attributes using, as you suggested, wp\_get\_attachment\_image\_src. Those dimensions are actually already recorded and stored when using the WP media uploader, it's likely that the plugin you're using ma...
316,282
<p>I am developing a new plugins, I added a new admin page menu with:</p> <pre><code>function ca_admin_link() { add_menu_page( 'Checklist Artistas', 'Checklist Artistas', 'checklist-artistas/includes/ca-checklist-acp-page.php' ); } add_action( 'admin_menu', 'ca_admin_link' ); </code></pre> <p>Everyt...
[ { "answer_id": 316270, "author": "Trisha", "author_id": 56458, "author_profile": "https://wordpress.stackexchange.com/users/56458", "pm_score": 2, "selected": false, "text": "<p>I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attach...
2018/10/09
[ "https://wordpress.stackexchange.com/questions/316282", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152047/" ]
I am developing a new plugins, I added a new admin page menu with: ``` function ca_admin_link() { add_menu_page( 'Checklist Artistas', 'Checklist Artistas', 'checklist-artistas/includes/ca-checklist-acp-page.php' ); } add_action( 'admin_menu', 'ca_admin_link' ); ``` Everything ok, an item menu is s...
I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attachment attributes using, as you suggested, wp\_get\_attachment\_image\_src. Those dimensions are actually already recorded and stored when using the WP media uploader, it's likely that the plugin you're using ma...
316,344
<p>I recently moved my new multisites network (which worked perfectly fine on an old domain) to my new domain. Now the website doesnt seem to work. The homepage doesnt load all images and even the menu isnt being loaded. Even after search and replacing my entire database and removing all the old url instances didnt wor...
[ { "answer_id": 316270, "author": "Trisha", "author_id": 56458, "author_profile": "https://wordpress.stackexchange.com/users/56458", "pm_score": 2, "selected": false, "text": "<p>I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attach...
2018/10/10
[ "https://wordpress.stackexchange.com/questions/316344", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/146426/" ]
I recently moved my new multisites network (which worked perfectly fine on an old domain) to my new domain. Now the website doesnt seem to work. The homepage doesnt load all images and even the menu isnt being loaded. Even after search and replacing my entire database and removing all the old url instances didnt work. ...
I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attachment attributes using, as you suggested, wp\_get\_attachment\_image\_src. Those dimensions are actually already recorded and stored when using the WP media uploader, it's likely that the plugin you're using ma...
316,372
<p>I'm using the X-Theme in Wordpress and I ran into an issue where I needed a CSS class in the <code>&lt;html&gt;</code> tag, but only on one page. This is the code I added into my child theme header file:</p> <pre><code>&lt;!-- If page#=103, add this class --&gt; &lt;?php if( is_page( 103 ) ) { ?&gt; ...
[ { "answer_id": 316270, "author": "Trisha", "author_id": 56458, "author_profile": "https://wordpress.stackexchange.com/users/56458", "pm_score": 2, "selected": false, "text": "<p>I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attach...
2018/10/10
[ "https://wordpress.stackexchange.com/questions/316372", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152116/" ]
I'm using the X-Theme in Wordpress and I ran into an issue where I needed a CSS class in the `<html>` tag, but only on one page. This is the code I added into my child theme header file: ``` <!-- If page#=103, add this class --> <?php if( is_page( 103 ) ) { ?> <html class="html-homepage"> <...
I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attachment attributes using, as you suggested, wp\_get\_attachment\_image\_src. Those dimensions are actually already recorded and stored when using the WP media uploader, it's likely that the plugin you're using ma...
316,382
<p>What is the correct process to make your jumbotron image dynamic (user changeable) via the WordPress customizer. Currently on my customers custom theme www.windupgram.co.uk I am using a static image, which I have to change when required. </p> <p>I would like to give the client an option to change the image wheneve...
[ { "answer_id": 316270, "author": "Trisha", "author_id": 56458, "author_profile": "https://wordpress.stackexchange.com/users/56458", "pm_score": 2, "selected": false, "text": "<p>I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attach...
2018/10/10
[ "https://wordpress.stackexchange.com/questions/316382", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/125815/" ]
What is the correct process to make your jumbotron image dynamic (user changeable) via the WordPress customizer. Currently on my customers custom theme www.windupgram.co.uk I am using a static image, which I have to change when required. I would like to give the client an option to change the image whenever they wan...
I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attachment attributes using, as you suggested, wp\_get\_attachment\_image\_src. Those dimensions are actually already recorded and stored when using the WP media uploader, it's likely that the plugin you're using ma...
316,387
<p>I want to upload an image and attach to it a category. This is my code:</p> <pre><code>function upload_cover(WP_REST_Request $request) { require_once( ABSPATH . 'wp-admin/includes/image.php' ); require_once( ABSPATH . 'wp-admin/includes/file.php' ); require_once( ABSPATH . 'wp-admin/includes/media.php'...
[ { "answer_id": 316432, "author": "Rachid Chihabi", "author_id": 151631, "author_profile": "https://wordpress.stackexchange.com/users/151631", "pm_score": 1, "selected": false, "text": "<p>First of all, if you want to apply categories to Attachments, you have to enable categories for the ...
2018/10/10
[ "https://wordpress.stackexchange.com/questions/316387", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152132/" ]
I want to upload an image and attach to it a category. This is my code: ``` function upload_cover(WP_REST_Request $request) { require_once( ABSPATH . 'wp-admin/includes/image.php' ); require_once( ABSPATH . 'wp-admin/includes/file.php' ); require_once( ABSPATH . 'wp-admin/includes/media.php' ); $atta...
First of all, if you want to apply categories to Attachments, you have to enable categories for the attachment. You can do this by using the [register\_taxonomy\_for\_object\_type()](http://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type) function. In your plugin file or theme functions file, ...
316,419
<p>Ok, I'm at wit's end with Wordpress. This is the fifth time I've tried installing it and it flat out is not working. </p> <p>When I install it, it shows one of the themes, but the default welcome post doesn't show up and when I log in it won't let me with the username and password I set up. Am I doing something wro...
[ { "answer_id": 316432, "author": "Rachid Chihabi", "author_id": 151631, "author_profile": "https://wordpress.stackexchange.com/users/151631", "pm_score": 1, "selected": false, "text": "<p>First of all, if you want to apply categories to Attachments, you have to enable categories for the ...
2018/10/11
[ "https://wordpress.stackexchange.com/questions/316419", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152155/" ]
Ok, I'm at wit's end with Wordpress. This is the fifth time I've tried installing it and it flat out is not working. When I install it, it shows one of the themes, but the default welcome post doesn't show up and when I log in it won't let me with the username and password I set up. Am I doing something wrong? The ...
First of all, if you want to apply categories to Attachments, you have to enable categories for the attachment. You can do this by using the [register\_taxonomy\_for\_object\_type()](http://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type) function. In your plugin file or theme functions file, ...
316,422
<p>I have created 1 custom post and some custom fields. </p> <ul> <li>Custom post type: Tour <ul> <li>Custom field: tour_id</li> </ul></li> </ul> <p>Now I want to customize permalink link structure, want to append "tour_id" value in link. I'm using below code.</p> <pre><code>add_action('init', 'pub_rewrite_rules');...
[ { "answer_id": 316436, "author": "Rachid Chihabi", "author_id": 151631, "author_profile": "https://wordpress.stackexchange.com/users/151631", "pm_score": 1, "selected": false, "text": "<p>I had the same technical need as you, and I have did this(code below) to get it work :</p>\n\n<pre><...
2018/10/11
[ "https://wordpress.stackexchange.com/questions/316422", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152163/" ]
I have created 1 custom post and some custom fields. * Custom post type: Tour + Custom field: tour\_id Now I want to customize permalink link structure, want to append "tour\_id" value in link. I'm using below code. ``` add_action('init', 'pub_rewrite_rules'); function pub_rewrite_rules() { global $wp_rewrite; ...
I had the same technical need as you, and I have did this(code below) to get it work : ``` function my_custom_rewrite_tag() { add_rewrite_tag('%xxx%', '([^&]+)'); //change the regex to your needs add_rewrite_tag('%yyy%', '([^&]+)'); //change the regex to your needs } add_action('init', 'my_custom_rewrite_tag', 10,...
316,438
<p><a href="https://i.stack.imgur.com/GBnga.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GBnga.png" alt="enter image description here"></a> </p> <p>So this is my code. This piece of code shows me the child page titles. But i'm providing the ID from the parent page. Is there a way to make this...
[ { "answer_id": 316444, "author": "Pim", "author_id": 50432, "author_profile": "https://wordpress.stackexchange.com/users/50432", "pm_score": -1, "selected": false, "text": "<p>Try the following:</p>\n\n<pre><code>&lt;?php\n\n global $post;\n\n $page_id = get_the_id();\n\n $childArgs =...
2018/10/11
[ "https://wordpress.stackexchange.com/questions/316438", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152168/" ]
[![enter image description here](https://i.stack.imgur.com/GBnga.png)](https://i.stack.imgur.com/GBnga.png) So this is my code. This piece of code shows me the child page titles. But i'm providing the ID from the parent page. Is there a way to make this dynamic? I don't want to use the ID cuz then its static.. ``` ...
//The correct code functions.php ``` function get_page_parent_id( $id ) { $args = array( 'sort_order' => 'ASC', 'sort_column' => 'menu_order', 'child_of' => $id ); $args = get_pages($args); if(is_array($pages)) $pageID = $id; else { $pageID = wp_get_post_parent_id( $id ); } return $pageID; } ?> ``` ...
316,469
<p>The problem I've run into is the WordPress for my website yesterday randomly stopped allowing us to edit any of the pages. Every time you click to edit a page it comes up with a 404 error. </p> <p>Things I have tried so far:</p> <ul> <li>Deactivated every plugin thinking that was the problem, but that didn't solve...
[ { "answer_id": 316444, "author": "Pim", "author_id": 50432, "author_profile": "https://wordpress.stackexchange.com/users/50432", "pm_score": -1, "selected": false, "text": "<p>Try the following:</p>\n\n<pre><code>&lt;?php\n\n global $post;\n\n $page_id = get_the_id();\n\n $childArgs =...
2018/10/11
[ "https://wordpress.stackexchange.com/questions/316469", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152182/" ]
The problem I've run into is the WordPress for my website yesterday randomly stopped allowing us to edit any of the pages. Every time you click to edit a page it comes up with a 404 error. Things I have tried so far: * Deactivated every plugin thinking that was the problem, but that didn't solve the issue * I have r...
//The correct code functions.php ``` function get_page_parent_id( $id ) { $args = array( 'sort_order' => 'ASC', 'sort_column' => 'menu_order', 'child_of' => $id ); $args = get_pages($args); if(is_array($pages)) $pageID = $id; else { $pageID = wp_get_post_parent_id( $id ); } return $pageID; } ?> ``` ...
316,472
<p>I am trying to run js function when customizer section is expended and cant seem to find any event to do so. </p> <p>Something like this </p> <pre><code>wp.customize.bind( 'ready', function() { wp.customize.section.bind( 'expand', function() { console.log('hello'); }); } ); </code></pre> <...
[ { "answer_id": 316558, "author": "Benn", "author_id": 67176, "author_profile": "https://wordpress.stackexchange.com/users/67176", "pm_score": 2, "selected": false, "text": "<p>Here it is </p>\n\n<pre><code>wp.customize.bind( 'ready', function() {\n\n wp.customize.section.each( functio...
2018/10/11
[ "https://wordpress.stackexchange.com/questions/316472", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/67176/" ]
I am trying to run js function when customizer section is expended and cant seem to find any event to do so. Something like this ``` wp.customize.bind( 'ready', function() { wp.customize.section.bind( 'expand', function() { console.log('hello'); }); } ); ``` or ``` wp.customize.bind( 're...
Here it is ``` wp.customize.bind( 'ready', function() { wp.customize.section.each( function ( section ) { section.expanded.bind( function( isExpanding ) { if(isExpanding){ console.log(section); } }); }); }); ```
316,508
<p>I want my site to have logo like when i go to google.com it shows the google logo with google at the tabs on top of browser. How can I achieve this for my wordpress site ?</p>
[ { "answer_id": 316558, "author": "Benn", "author_id": 67176, "author_profile": "https://wordpress.stackexchange.com/users/67176", "pm_score": 2, "selected": false, "text": "<p>Here it is </p>\n\n<pre><code>wp.customize.bind( 'ready', function() {\n\n wp.customize.section.each( functio...
2018/10/12
[ "https://wordpress.stackexchange.com/questions/316508", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152109/" ]
I want my site to have logo like when i go to google.com it shows the google logo with google at the tabs on top of browser. How can I achieve this for my wordpress site ?
Here it is ``` wp.customize.bind( 'ready', function() { wp.customize.section.each( function ( section ) { section.expanded.bind( function( isExpanding ) { if(isExpanding){ console.log(section); } }); }); }); ```
316,530
<p>I've a problem with some functions on function.php. I want to use get_tems_by("slug", $slug, "category"); but it doesn't work inside a function on function.php. When i changed slug by ID and give a random ID it's work. I'm sure that the slug exist. I've also try that : </p> <pre><code>add_action( 'init', 'wpse2711...
[ { "answer_id": 316574, "author": "Remzi Cavdar", "author_id": 149484, "author_profile": "https://wordpress.stackexchange.com/users/149484", "pm_score": 1, "selected": false, "text": "<p>Did you try to use add_action without priority? On the last line, you specify the priority. Lower numb...
2018/10/12
[ "https://wordpress.stackexchange.com/questions/316530", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152232/" ]
I've a problem with some functions on function.php. I want to use get\_tems\_by("slug", $slug, "category"); but it doesn't work inside a function on function.php. When i changed slug by ID and give a random ID it's work. I'm sure that the slug exist. I've also try that : ``` add_action( 'init', 'wpse27111_tester', 9...
Did you try to use add\_action without priority? On the last line, you specify the priority. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. ``` function test_1234567() { // Get term by name ''news'' in Categories...
316,541
<p>I want to show avatar from the post author. I use Ultimate Members and want to show the avatars that are defined via UM.</p> <pre><code>&lt;?php global $post; $url = get_avatar_url( $post, array( 'size' =&gt; 48 )); $img = '&lt;img alt="" src="'. $url .'"&gt;'; echo $img; ?&gt; </code></pre> <p>But this code shows...
[ { "answer_id": 316574, "author": "Remzi Cavdar", "author_id": 149484, "author_profile": "https://wordpress.stackexchange.com/users/149484", "pm_score": 1, "selected": false, "text": "<p>Did you try to use add_action without priority? On the last line, you specify the priority. Lower numb...
2018/10/12
[ "https://wordpress.stackexchange.com/questions/316541", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152174/" ]
I want to show avatar from the post author. I use Ultimate Members and want to show the avatars that are defined via UM. ``` <?php global $post; $url = get_avatar_url( $post, array( 'size' => 48 )); $img = '<img alt="" src="'. $url .'">'; echo $img; ?> ``` But this code shows the gravatars or default avatar. How can...
Did you try to use add\_action without priority? On the last line, you specify the priority. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. ``` function test_1234567() { // Get term by name ''news'' in Categories...
316,546
<p>The shortcode for the MailChimp subscribe form in my theme's custom homepage is not working. But when I put the same shortcode in a blog page and other pages, then it is working</p> <p>I put the shortcode <code>[mc4wp_form id=&quot;id&quot;]</code> in theme pages and it's working.</p> <p>But when I put <code>&lt;?ph...
[ { "answer_id": 316548, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 1, "selected": false, "text": "<p>You're missing quotes around the shortcode in the <code>do_shortcode()</code> function:</p>\n\n<pre><co...
2018/10/12
[ "https://wordpress.stackexchange.com/questions/316546", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/149030/" ]
The shortcode for the MailChimp subscribe form in my theme's custom homepage is not working. But when I put the same shortcode in a blog page and other pages, then it is working I put the shortcode `[mc4wp_form id="id"]` in theme pages and it's working. But when I put `<?php echo do_shortcode ([mc4wp_form id="id"]); ...
The common way to approach this is to use `do_shortcode()`. But that's not an efficient way to do it because it has to run a pretty extensive regex (regular expression) to parse through every single shortcode in your WP install to get to the one you are asking for. [See this post for a more thorough explanation](https:...
316,550
<p>I registered a new footer widget with this code.</p> <pre><code>register_sidebar(array( 'name' =&gt; esc_html__( 'Footer Sidebarprestige', 'realtor' ), 'id' =&gt; 'footer-sidebarprestige', 'description' =&gt; esc_html__( 'Widgets in this area will be shown in Footer Area.', 'realtor' ), 'class'=&gt;'', 'b...
[ { "answer_id": 316552, "author": "Pim", "author_id": 50432, "author_profile": "https://wordpress.stackexchange.com/users/50432", "pm_score": 3, "selected": true, "text": "<p>There are several ways you can achieve this:</p>\n\n<p>A. Use CSS to hide and show widgets based on which page you...
2018/10/12
[ "https://wordpress.stackexchange.com/questions/316550", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/146043/" ]
I registered a new footer widget with this code. ``` register_sidebar(array( 'name' => esc_html__( 'Footer Sidebarprestige', 'realtor' ), 'id' => 'footer-sidebarprestige', 'description' => esc_html__( 'Widgets in this area will be shown in Footer Area.', 'realtor' ), 'class'=>'', 'before_widget'=>'<li id="%1...
There are several ways you can achieve this: A. Use CSS to hide and show widgets based on which page you are on. This is fine as a workaround, but it isn't really solving your problem, especially if you have lots of pages/widgets. B. Call a different widget area in your template file with conditional logic ``` <ul c...
316,576
<p>I have a ton of posts that we created, but unfortunately there are a lot of blank spaces. This is an example of what I see on the backend, in the actual post:</p> <pre><code>&lt;h1&gt;This is a post title&lt;/h1&gt; &amp;nbsp; &amp;nbsp; Words here. More words. &amp;nbsp; &amp;nbsp; Words down here. </c...
[ { "answer_id": 316584, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 2, "selected": true, "text": "<p>Since there are no tags around the space <code>&amp;nbsp;</code> characters, they will be compressed on...
2018/10/12
[ "https://wordpress.stackexchange.com/questions/316576", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/147631/" ]
I have a ton of posts that we created, but unfortunately there are a lot of blank spaces. This is an example of what I see on the backend, in the actual post: ``` <h1>This is a post title</h1> &nbsp; &nbsp; Words here. More words. &nbsp; &nbsp; Words down here. ``` So, when that is rendered on the page on the ...
Since there are no tags around the space `&nbsp;` characters, they will be compressed on the page output. So the visual output will not be affected. And a very minor effect on the database or processing of the post content. If you are really concerned about the extra stuff, then you could use `the_content` filter to...
316,579
<p>I inherited a WordPress site that has a lot of custom coding that appears to be Bootstrap. A contact form is coded in a PHP file and the client would like to add a couple more email addresses for submissions to be sent to.</p> <p>I've found the code for sending the email, but I want to make sure that I update it co...
[ { "answer_id": 316580, "author": "Liam Stewart", "author_id": 121955, "author_profile": "https://wordpress.stackexchange.com/users/121955", "pm_score": 1, "selected": false, "text": "<p>Looking at the snippet you provided the solution seems to be your last solution.</p>\n\n<pre><code>$em...
2018/10/12
[ "https://wordpress.stackexchange.com/questions/316579", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/127744/" ]
I inherited a WordPress site that has a lot of custom coding that appears to be Bootstrap. A contact form is coded in a PHP file and the client would like to add a couple more email addresses for submissions to be sent to. I've found the code for sending the email, but I want to make sure that I update it correctly an...
Looking at the snippet you provided the solution seems to be your last solution. ``` $emails = array( $email, 'myemail@me.com','anotheremail@me.com' ); ``` Sending an array of emails, the first one (`$email`) being the dynamic email. The second and third would be hard coded values. This is assuming the email handle...
316,590
<p>For the contact form of my own theme I have created a Custom Post Type in which the messages of the users are automatically stored. In the administration area the messages can be read similar to comments.</p> <p>By doing this, you can create, change and delete messages in the administration area. All these function...
[ { "answer_id": 316594, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 0, "selected": false, "text": "<p>You are correct that the <code>read</code> capability is intended for the frontend. <strong>The capability y...
2018/10/12
[ "https://wordpress.stackexchange.com/questions/316590", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93282/" ]
For the contact form of my own theme I have created a Custom Post Type in which the messages of the users are automatically stored. In the administration area the messages can be read similar to comments. By doing this, you can create, change and delete messages in the administration area. All these functionalities sh...
You are correct that the `read` capability is intended for the frontend. **The capability you're looking for does not exist**. Additionally, if it did exist ( which it does not ), the WP Admin user interface does not provide a UI for viewing/reading posts, only addition and editing. If you want it, I'm afraid you hav...
316,615
<p>So in this quest to build a custom pseudo web chat service with Telegram, I'm trying to get the messages Telegram sends to the server and redirect them to frontend. SSE with <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventSource" rel="nofollow noreferrer">HTML5 EventSource</a> seems the best and easy ...
[ { "answer_id": 316753, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 2, "selected": false, "text": "<p>This is because the rest API internally uses <code>json_encode()</code> to output the data. There are 2 way...
2018/10/13
[ "https://wordpress.stackexchange.com/questions/316615", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/145926/" ]
So in this quest to build a custom pseudo web chat service with Telegram, I'm trying to get the messages Telegram sends to the server and redirect them to frontend. SSE with [HTML5 EventSource](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) seems the best and easy solution to do that. The thing is that ...
This is because the rest API internally uses `json_encode()` to output the data. There are 2 ways that you can resolve this. 1. Prevent the API from sending the data ---------------------------------------- This might be a bit odd and raise some issues, but you can set the header type and echo the content before retu...
316,624
<p>When created a new page or post or columns blocks we get the "Write your story" placeholder. Can this be removed or replaced, in custom blocks? How?</p> <p><a href="https://i.stack.imgur.com/XY26Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XY26Z.png" alt="enter image description here"></a></...
[ { "answer_id": 316677, "author": "admcfajn", "author_id": 123674, "author_profile": "https://wordpress.stackexchange.com/users/123674", "pm_score": 0, "selected": false, "text": "<p>Here's an example block taken from <a href=\"https://github.com/WordPress/gutenberg-examples\" rel=\"nofol...
2018/10/13
[ "https://wordpress.stackexchange.com/questions/316624", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111085/" ]
When created a new page or post or columns blocks we get the "Write your story" placeholder. Can this be removed or replaced, in custom blocks? How? [![enter image description here](https://i.stack.imgur.com/XY26Z.png)](https://i.stack.imgur.com/XY26Z.png)
There does seem to be a filter to modify the default: <https://github.com/WordPress/gutenberg/blob/master/lib/client-assets.php#L1574> ``` 'bodyPlaceholder' => apply_filters( 'write_your_story', __( 'Write your story', 'gutenberg' ), $post ), ``` So you should be able to use the WordPress [add\_filter()](http...
316,646
<p>What does this .htaccess do?</p> <p>Am I correct in thinking that all it does is prevent automatic brute force attacks?</p> <p>So, to access the wp-login.php you have to manually type in the URL of the domain so that negates all the bots seeking out wp-login.php</p> <p>Am I correct?</p> <p>Here's the .htaccess r...
[ { "answer_id": 316648, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 3, "selected": false, "text": "<p>It appears to prevent any POST requests to wp-login.php that aren't made from a page on my-domain.com. ...
2018/10/14
[ "https://wordpress.stackexchange.com/questions/316646", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93691/" ]
What does this .htaccess do? Am I correct in thinking that all it does is prevent automatic brute force attacks? So, to access the wp-login.php you have to manually type in the URL of the domain so that negates all the bots seeking out wp-login.php Am I correct? Here's the .htaccess rule: ``` <IfModule mod_rewrite...
It appears to prevent any POST requests to wp-login.php that aren't made from a page on my-domain.com. When the browser sends a POST request, say after submitting a form, it will include a HTTP Referrer header telling the server where the request came from. This theoretically prevents bots submitting POST requests d...
316,686
<p>wordpress's default Recent Comments widget is showing the user's email address instead of their display/first name.. </p> <p>get_comment_author() just changes the email address to 'anonymous'....</p> <p>What do I change exactly to make it show the commenter's name instead?</p> <pre><code>$output .= sprintf( _x( '...
[ { "answer_id": 316648, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 3, "selected": false, "text": "<p>It appears to prevent any POST requests to wp-login.php that aren't made from a page on my-domain.com. ...
2018/10/15
[ "https://wordpress.stackexchange.com/questions/316686", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134482/" ]
wordpress's default Recent Comments widget is showing the user's email address instead of their display/first name.. get\_comment\_author() just changes the email address to 'anonymous'.... What do I change exactly to make it show the commenter's name instead? ``` $output .= sprintf( _x( '%1$s on %2$s', 'widgets' )...
It appears to prevent any POST requests to wp-login.php that aren't made from a page on my-domain.com. When the browser sends a POST request, say after submitting a form, it will include a HTTP Referrer header telling the server where the request came from. This theoretically prevents bots submitting POST requests d...
316,698
<p>I'm using this code to try and check the last post on each page loop is even so i can add different classes.</p> <p>This works to check if its the last post :</p> <pre><code>( ( 1 == $wp_query-&gt;current_post + 1 ) == $wp_query-&gt;post_count ) </code></pre> <p>This works to check if its a even post</p> <pre><c...
[ { "answer_id": 316648, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 3, "selected": false, "text": "<p>It appears to prevent any POST requests to wp-login.php that aren't made from a page on my-domain.com. ...
2018/10/15
[ "https://wordpress.stackexchange.com/questions/316698", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110232/" ]
I'm using this code to try and check the last post on each page loop is even so i can add different classes. This works to check if its the last post : ``` ( ( 1 == $wp_query->current_post + 1 ) == $wp_query->post_count ) ``` This works to check if its a even post ``` ( $wp_query->current_post % 2 == 0 ) ``` But...
It appears to prevent any POST requests to wp-login.php that aren't made from a page on my-domain.com. When the browser sends a POST request, say after submitting a form, it will include a HTTP Referrer header telling the server where the request came from. This theoretically prevents bots submitting POST requests d...
316,705
<p>I want to use different logo for my home page and another logo for others page in wordpress.what will be the changes in header file and css.Currently i am using terminus theme.</p>
[ { "answer_id": 316712, "author": "Pratik Patel", "author_id": 143123, "author_profile": "https://wordpress.stackexchange.com/users/143123", "pm_score": 2, "selected": false, "text": "<p>You can do that using condition in your header file like</p>\n\n<pre><code>if(is_front_page() || is_ho...
2018/10/15
[ "https://wordpress.stackexchange.com/questions/316705", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152343/" ]
I want to use different logo for my home page and another logo for others page in wordpress.what will be the changes in header file and css.Currently i am using terminus theme.
You can do that using condition in your header file like ``` if(is_front_page() || is_home()) { // PUT YOUR HOME PAGE LOGO HERE }else{ // PUT LOGO FOR INNER PAGES } ``` Hope it will help you!
316,719
<p>I am developing a custom Gutenberg block with the PanelColorSettings component to set up the background color, here is my code</p> <pre><code>&lt;PanelColorSettings title={ __( 'Color Settings' ) } colorSettings={ [ { value:...
[ { "answer_id": 319664, "author": "Till", "author_id": 154359, "author_profile": "https://wordpress.stackexchange.com/users/154359", "pm_score": 2, "selected": false, "text": "<p>I could solve it with the function getColorObjectByColorValue (<a href=\"https://github.com/WordPress/gutenber...
2018/10/15
[ "https://wordpress.stackexchange.com/questions/316719", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152355/" ]
I am developing a custom Gutenberg block with the PanelColorSettings component to set up the background color, here is my code ``` <PanelColorSettings title={ __( 'Color Settings' ) } colorSettings={ [ { value: backgroundColor,...
I could solve it with the function getColorObjectByColorValue ([take a look at the gutenberg files](https://github.com/WordPress/gutenberg/blob/9297fc93a2c7b47575007127ffe038d22101de81/packages/editor/src/components/colors/utils.js)). If you have something like ``` const backgroundColors = [ { nam...
316,777
<p>I have imported a large amount of content using WPAllImport, all to a custom post type called "article" ("Articles") and all organised by a custom taxonomy type called "source" ("Sources").</p> <p>However, on the edit-tags.php page for the Sources taxonomy listing, the Articles post counts are all inaccurate.</p> ...
[ { "answer_id": 317517, "author": "Robert Andrews", "author_id": 39300, "author_profile": "https://wordpress.stackexchange.com/users/39300", "pm_score": 2, "selected": false, "text": "<p>The question arose out of misinterpretation...</p>\n\n<p>On the taxonomy list in question, the Count n...
2018/10/15
[ "https://wordpress.stackexchange.com/questions/316777", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/39300/" ]
I have imported a large amount of content using WPAllImport, all to a custom post type called "article" ("Articles") and all organised by a custom taxonomy type called "source" ("Sources"). However, on the edit-tags.php page for the Sources taxonomy listing, the Articles post counts are all inaccurate. There is one t...
It only took 3.5-years for someone to be put into the position of @robert-andrews to chase down the post count problem. While having the same problem (and misinterpretation), I ran across your post yesterday in my search for answers. Nothing good really turned up. So, I was forced to trace the code and take the long wa...
316,782
<p>Please help me to figure this out that I want to show <strong>thumbnails along with recent post from a wordpress blog on static website's homepage</strong>. </p> <p>Following code are working fine but I need to show one single image from post as thumbnail:</p> <blockquote> <pre><code>&lt;?php define('WP_USE_THEMES...
[ { "answer_id": 317517, "author": "Robert Andrews", "author_id": 39300, "author_profile": "https://wordpress.stackexchange.com/users/39300", "pm_score": 2, "selected": false, "text": "<p>The question arose out of misinterpretation...</p>\n\n<p>On the taxonomy list in question, the Count n...
2018/10/15
[ "https://wordpress.stackexchange.com/questions/316782", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152395/" ]
Please help me to figure this out that I want to show **thumbnails along with recent post from a wordpress blog on static website's homepage**. Following code are working fine but I need to show one single image from post as thumbnail: > > > ``` > <?php > define('WP_USE_THEMES', false); > require('blog/wp-blog-hea...
It only took 3.5-years for someone to be put into the position of @robert-andrews to chase down the post count problem. While having the same problem (and misinterpretation), I ran across your post yesterday in my search for answers. Nothing good really turned up. So, I was forced to trace the code and take the long wa...
316,853
<p>I'd like to be have more control on the srcset on certain important images of my website if not all.</p> <p>By default the srcset includes all the sizes created by wordpress for all the images. I'd like to be able to choose which sizes will be taken among all the different sizes created by wordpress.</p> <p>To be ...
[ { "answer_id": 316881, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 2, "selected": false, "text": "<p>There is a filter <code>max_srcset_image_width</code> that lets you limit the sizes used in a <code>src...
2018/10/16
[ "https://wordpress.stackexchange.com/questions/316853", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152357/" ]
I'd like to be have more control on the srcset on certain important images of my website if not all. By default the srcset includes all the sizes created by wordpress for all the images. I'd like to be able to choose which sizes will be taken among all the different sizes created by wordpress. To be very clear here i...
There is a filter `max_srcset_image_width` that lets you limit the sizes used in a `srcset` attribute to those that are less than a given maximum width. This code will make it so that only sizes < 500 pixels wide will be used in the `srcset`: ``` /** * @param int $max_width The maximum image width to be included ...
316,890
<p>Forcing www to non-www is simple at the primary domain level.</p> <p>What about at the subdomain level?</p> <p>If I am correct the "issue" is that it is at two levels of depth so you can't force a subdomain to be non-www</p> <p>This is what I mean:</p> <pre><code>https://my.domain.com &lt; correct https://www.my...
[ { "answer_id": 316892, "author": "Coomie", "author_id": 152479, "author_profile": "https://wordpress.stackexchange.com/users/152479", "pm_score": 0, "selected": false, "text": "<p>This would probably only happen if you are erroneously redirecting to www.my.domain.com in your htaccess. So...
2018/10/17
[ "https://wordpress.stackexchange.com/questions/316890", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93691/" ]
Forcing www to non-www is simple at the primary domain level. What about at the subdomain level? If I am correct the "issue" is that it is at two levels of depth so you can't force a subdomain to be non-www This is what I mean: ``` https://my.domain.com < correct https://www.my.domain.com < incorrect and trying to ...
> > Forcing www to non-www is simple at the primary domain level. > > > It's actually the same for the subdomain (depending on how you've written the directives in the first place). If the hostname (main domain or subdmomain) starts with `www.` then remove it. (Forcing non-www to www for subdomains *and* main dom...
316,897
<p>I have tried several things but unfortunately do not manage to do it in a good way.</p> <p>I use a while loop to pick up dealers (custom post type) from different countries and provinces. In this loop of dealers I want to categorize them in countries and provinces.</p> <p>The main category of a dealer is a country...
[ { "answer_id": 316892, "author": "Coomie", "author_id": 152479, "author_profile": "https://wordpress.stackexchange.com/users/152479", "pm_score": 0, "selected": false, "text": "<p>This would probably only happen if you are erroneously redirecting to www.my.domain.com in your htaccess. So...
2018/10/17
[ "https://wordpress.stackexchange.com/questions/316897", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/49429/" ]
I have tried several things but unfortunately do not manage to do it in a good way. I use a while loop to pick up dealers (custom post type) from different countries and provinces. In this loop of dealers I want to categorize them in countries and provinces. The main category of a dealer is a country and then there i...
> > Forcing www to non-www is simple at the primary domain level. > > > It's actually the same for the subdomain (depending on how you've written the directives in the first place). If the hostname (main domain or subdmomain) starts with `www.` then remove it. (Forcing non-www to www for subdomains *and* main dom...
316,927
<p>I am trying to get the post thumbnail image for each accordion or show accordion post thumbnail outside of the loop.</p> <p>Currently, it's setup with image empty but I need each thumb to represent the currently on click accordion. </p> <p>can you add jquery when each accordion click function should add a class ...
[ { "answer_id": 316929, "author": "ManzoorWani", "author_id": 113465, "author_profile": "https://wordpress.stackexchange.com/users/113465", "pm_score": -1, "selected": false, "text": "<p>You can use this if you have the <code>$post_id</code></p>\n\n<pre><code>$thumbnail_id = get_post_thum...
2018/10/17
[ "https://wordpress.stackexchange.com/questions/316927", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24510/" ]
I am trying to get the post thumbnail image for each accordion or show accordion post thumbnail outside of the loop. Currently, it's setup with image empty but I need each thumb to represent the currently on click accordion. can you add jquery when each accordion click function should add a class on the `<div class=...
Off top of my head here's two possible solution concepts. 1) Just run the custom loop (I meant to type, query) again and this time use it with only `the_post_thumbnail`. ``` <?php if ($myposts->have_posts() ) : ?> <div class="image-wrapper e-in"> <?php while ($myposts ->have_posts() ) : $myposts ->the_post(); ?> <di...
316,932
<p>On the website I'm developing, I need all login-related forms to be on custom, branded pages. I have pretty much covered them all, but I have just one case I can't manage correctly.</p> <p>I have set a custom page for the <em>Lost password?</em> page, by adding the filter below, then creating a new page with a cust...
[ { "answer_id": 316936, "author": "djboris", "author_id": 152412, "author_profile": "https://wordpress.stackexchange.com/users/152412", "pm_score": 3, "selected": true, "text": "<p>Try this:</p>\n\n<pre><code>add_action( 'lost_password', 'wpse316932_redirect_wrong_email' );\nfunction wpse...
2018/10/17
[ "https://wordpress.stackexchange.com/questions/316932", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/107437/" ]
On the website I'm developing, I need all login-related forms to be on custom, branded pages. I have pretty much covered them all, but I have just one case I can't manage correctly. I have set a custom page for the *Lost password?* page, by adding the filter below, then creating a new page with a custom template that ...
Try this: ``` add_action( 'lost_password', 'wpse316932_redirect_wrong_email' ); function wpse316932_redirect_wrong_email() { global $errors; if ( $error = $errors->get_error_code() ) { wp_safe_redirect( 'lost-password/?error=' . $error ); } else { wp_safe_redirect( 'lost-password/' ); ...
316,952
<p>Instead of bogging down my child theme's <code>functions.php</code> file, I would like to have a separate .php file that has various functions, that I can call within <code>functions.php</code> (and in other files).</p> <p>I have created <code>my-custom-functions.php</code> within my child theme, where the <code>fu...
[ { "answer_id": 316955, "author": "BruceWayne", "author_id": 147631, "author_profile": "https://wordpress.stackexchange.com/users/147631", "pm_score": 0, "selected": false, "text": "<p>The error was using <code>get_theme_roots()</code>. This returns a relative path.</p>\n\n<p><code>get_t...
2018/10/17
[ "https://wordpress.stackexchange.com/questions/316952", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/147631/" ]
Instead of bogging down my child theme's `functions.php` file, I would like to have a separate .php file that has various functions, that I can call within `functions.php` (and in other files). I have created `my-custom-functions.php` within my child theme, where the `functions.php` lives. Here's the folder structur...
`get_theme_roots()` and `get_theme_root()` aren't really appropriate functions for getting the path to a file from a theme. I recommend you use [`get_theme_file_path()`](https://developer.wordpress.org/reference/functions/get_theme_file_path/) instead: ``` include_once get_theme_file_path( 'grow-minimal-child/rs-cust...
316,994
<p>I am actually building a custom theme for my blog and I use single quotes for HTML everywhere like:</p> <pre><code>&lt;div class='div'&gt;&lt;/div&gt; </code></pre> <p>Does this cause me redirection to index.php??</p> <p>My site correctly redirects at 301, mod_rewrite is enabled and responses to links but open in...
[ { "answer_id": 316955, "author": "BruceWayne", "author_id": 147631, "author_profile": "https://wordpress.stackexchange.com/users/147631", "pm_score": 0, "selected": false, "text": "<p>The error was using <code>get_theme_roots()</code>. This returns a relative path.</p>\n\n<p><code>get_t...
2018/10/18
[ "https://wordpress.stackexchange.com/questions/316994", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152554/" ]
I am actually building a custom theme for my blog and I use single quotes for HTML everywhere like: ``` <div class='div'></div> ``` Does this cause me redirection to index.php?? My site correctly redirects at 301, mod\_rewrite is enabled and responses to links but open index.php. Is this because I used single quote...
`get_theme_roots()` and `get_theme_root()` aren't really appropriate functions for getting the path to a file from a theme. I recommend you use [`get_theme_file_path()`](https://developer.wordpress.org/reference/functions/get_theme_file_path/) instead: ``` include_once get_theme_file_path( 'grow-minimal-child/rs-cust...
317,003
<p>So I am using nested blocks in Wordpress Gutenberg. I am applying a wrapper on my elements that apply a bootstrap container class. Obviously I'd only want that on the outermost blocks, not on the ones inside a nested block.</p> <p>Is there a way to know if the current block is inside a <code>InnerBlocks</code> Defi...
[ { "answer_id": 346863, "author": "N. Seghir", "author_id": 154459, "author_profile": "https://wordpress.stackexchange.com/users/154459", "pm_score": 3, "selected": false, "text": "<p>you can call <code>getBlockHierarchyRootClientId</code> with the clientId of the block, <code>getBlockHie...
2018/10/18
[ "https://wordpress.stackexchange.com/questions/317003", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42572/" ]
So I am using nested blocks in Wordpress Gutenberg. I am applying a wrapper on my elements that apply a bootstrap container class. Obviously I'd only want that on the outermost blocks, not on the ones inside a nested block. Is there a way to know if the current block is inside a `InnerBlocks` Definiton of a parent blo...
you can call `getBlockHierarchyRootClientId` with the clientId of the block, `getBlockHierarchyRootClientId` will return the parent block id if the current block is inside innerBlocks and will return the same id if it's root you can call it like this ``` wp.data.select( 'core/editor' ).getBlockHierarchyRootClientId( ...
317,005
<p>I have like 5 parent pages and would like to echo all their title's on the front page.php. Maybe with get_the_id(); but don't know how.</p>
[ { "answer_id": 317006, "author": "Michael", "author_id": 133863, "author_profile": "https://wordpress.stackexchange.com/users/133863", "pm_score": 1, "selected": false, "text": "<p>Check <a href=\"https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters\" rel=\"nofol...
2018/10/18
[ "https://wordpress.stackexchange.com/questions/317005", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152168/" ]
I have like 5 parent pages and would like to echo all their title's on the front page.php. Maybe with get\_the\_id(); but don't know how.
Check [Post & Page Parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters) or [get\_page\_children()](https://codex.wordpress.org/Function_Reference/get_page_children). ``` <?php global $post; $args = array( 'post_type' => 'page', 'posts_per_page' => -1, 'post_parent...
317,012
<p>I have tried to update a gallery field and the images shows up in frontend but not the backend.</p> <pre><code>// I have also tried to use the ACF field name like $field = 'field_xxxxxxxxxxxxx'; $field = 'images'; $post_id = 12345; $attachments_ids = [ 0 =&gt; 22222, 1 =&gt; 33333, 2 =&gt; 44444, ...
[ { "answer_id": 317006, "author": "Michael", "author_id": 133863, "author_profile": "https://wordpress.stackexchange.com/users/133863", "pm_score": 1, "selected": false, "text": "<p>Check <a href=\"https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters\" rel=\"nofol...
2018/10/18
[ "https://wordpress.stackexchange.com/questions/317012", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9564/" ]
I have tried to update a gallery field and the images shows up in frontend but not the backend. ``` // I have also tried to use the ACF field name like $field = 'field_xxxxxxxxxxxxx'; $field = 'images'; $post_id = 12345; $attachments_ids = [ 0 => 22222, 1 => 33333, 2 => 44444, 3 => 55555 ]; update_...
Check [Post & Page Parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters) or [get\_page\_children()](https://codex.wordpress.org/Function_Reference/get_page_children). ``` <?php global $post; $args = array( 'post_type' => 'page', 'posts_per_page' => -1, 'post_parent...
317,019
<p>How can I show the title when a checkbox is checked. I use Advanced custom fields</p> <p>my field name is nav</p> <p>This is what i currently have.</p> <pre><code>&lt;?php if(get_field('nav')) { ?&gt; &lt;li&gt; &lt;a href="&lt;?php the_permalink()?&gt;" class="active"&gt;&lt;?php the_title();?&gt;&lt;/a&gt; ...
[ { "answer_id": 317020, "author": "djboris", "author_id": 152412, "author_profile": "https://wordpress.stackexchange.com/users/152412", "pm_score": 0, "selected": false, "text": "<p>You would like to use ACF true/false field > <a href=\"https://www.advancedcustomfields.com/resources/true-...
2018/10/18
[ "https://wordpress.stackexchange.com/questions/317019", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152168/" ]
How can I show the title when a checkbox is checked. I use Advanced custom fields my field name is nav This is what i currently have. ``` <?php if(get_field('nav')) { ?> <li> <a href="<?php the_permalink()?>" class="active"><?php the_title();?></a> </li> <?php } ?> ```
You would like to use ACF true/false field > [link](https://www.advancedcustomfields.com/resources/true-false/) Then basically in your template wrap the title element in conditional, like this: ``` if( get_field( 'title_show_or_whatever' ) ) { // The title element } ```
317,035
<p>I am upgrading Font Awesome 4 to version 5 which introduces both integrity and crossorigin attributes to the <code>&lt;link rel="stylesheet"&gt;</code> markup. </p> <p><em>Currently, I am using:</em></p> <pre><code>wp_register_style('FontAwesome', 'https://example.com/font-awesome.min.css', array(), null, 'all' );...
[ { "answer_id": 319773, "author": "Remzi Cavdar", "author_id": 149484, "author_profile": "https://wordpress.stackexchange.com/users/149484", "pm_score": 6, "selected": true, "text": "<p><strong>style_loader_tag</strong><br>\nstyle_loader_tag is an official WordPress API, see the documenta...
2018/10/18
[ "https://wordpress.stackexchange.com/questions/317035", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/54879/" ]
I am upgrading Font Awesome 4 to version 5 which introduces both integrity and crossorigin attributes to the `<link rel="stylesheet">` markup. *Currently, I am using:* ``` wp_register_style('FontAwesome', 'https://example.com/font-awesome.min.css', array(), null, 'all' ); wp_enqueue_style('FontAwesome'); ``` *Whic...
**style\_loader\_tag** style\_loader\_tag is an official WordPress API, see the documentation: <https://developer.wordpress.org/reference/hooks/style_loader_tag/> > > `apply_filters( 'style_loader_tag', $html, $handle, $href, $media )` > Filters the HTML link tag of an enqueued > style. > > > First enqueue ...
317,056
<p>I'm trying to insert a dropdown (via HTML string) in to every <code>post</code> I have.</p> <p>I'd like to add it before the post information, but below the website nav. bar and header.</p> <p>In the screenshot, you'll notice it's added to the <em>very top</em>. I want it to be moved in the designated area. </p> ...
[ { "answer_id": 317058, "author": "jdm2112", "author_id": 45202, "author_profile": "https://wordpress.stackexchange.com/users/45202", "pm_score": 2, "selected": false, "text": "<p>Edit your single.php or single-post.php template, depending on which one is present and in use with your them...
2018/10/18
[ "https://wordpress.stackexchange.com/questions/317056", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/147631/" ]
I'm trying to insert a dropdown (via HTML string) in to every `post` I have. I'd like to add it before the post information, but below the website nav. bar and header. In the screenshot, you'll notice it's added to the *very top*. I want it to be moved in the designated area. [![enter image description here](https:...
Edit your single.php or single-post.php template, depending on which one is present and in use with your theme. The JS file should be registered and conditionally enqueued when the template is loaded. This allows for dependency management and lots of other easy management actions. Another way to consider is make your...
317,061
<p><a href="https://i.stack.imgur.com/ol9wx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ol9wx.png" alt="enter image description here"></a>The client will be entering information for the year a report was produced (eg. 2010). I want to take that information and calculate if it was made in the last...
[ { "answer_id": 317058, "author": "jdm2112", "author_id": 45202, "author_profile": "https://wordpress.stackexchange.com/users/45202", "pm_score": 2, "selected": false, "text": "<p>Edit your single.php or single-post.php template, depending on which one is present and in use with your them...
2018/10/18
[ "https://wordpress.stackexchange.com/questions/317061", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152408/" ]
[![enter image description here](https://i.stack.imgur.com/ol9wx.png)](https://i.stack.imgur.com/ol9wx.png)The client will be entering information for the year a report was produced (eg. 2010). I want to take that information and calculate if it was made in the last 3 years so I can display it in a 'recent documents' s...
Edit your single.php or single-post.php template, depending on which one is present and in use with your theme. The JS file should be registered and conditionally enqueued when the template is loaded. This allows for dependency management and lots of other easy management actions. Another way to consider is make your...
317,073
<p>I checked the HTML validator. But, the message is the following.</p> <blockquote> <p>Quote " in attribute name. Probable cause: Matching quote missing somewhere earlier.</p> </blockquote> <p>The meta description is automatic from the content. So, if the content includes the quotation, it is also included in me...
[ { "answer_id": 317114, "author": "Heres2u", "author_id": 140036, "author_profile": "https://wordpress.stackexchange.com/users/140036", "pm_score": 1, "selected": false, "text": "<p>Without knowing further details of your specific installation:</p>\n\n<ol>\n<li>Make sure you are actually ...
2018/10/19
[ "https://wordpress.stackexchange.com/questions/317073", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151822/" ]
I checked the HTML validator. But, the message is the following. > > Quote " in attribute name. Probable cause: Matching quote missing > somewhere earlier. > > > The meta description is automatic from the content. So, if the content includes the quotation, it is also included in meta descrption. I would like to ...
Without knowing further details of your specific installation: 1. Make sure you are actually previewing live on the web in a browser to see if the short-code actually is working. 2. Make sure you have spelled the short-code correctly, and have the correct syntax. (See theme's documentation.) 3. If the short-code requi...
317,084
<p>My question is close to other questions, but I dont' have enough reputation to comment.</p> <p>I'm working for a restaurant and I 'd like, for my menu page, to organise my posts "meal" under terms "cat_meal".</p> <p>This terms should respect an order (dessert after starter for example). And that's my probleme : I...
[ { "answer_id": 317114, "author": "Heres2u", "author_id": 140036, "author_profile": "https://wordpress.stackexchange.com/users/140036", "pm_score": 1, "selected": false, "text": "<p>Without knowing further details of your specific installation:</p>\n\n<ol>\n<li>Make sure you are actually ...
2018/10/19
[ "https://wordpress.stackexchange.com/questions/317084", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110465/" ]
My question is close to other questions, but I dont' have enough reputation to comment. I'm working for a restaurant and I 'd like, for my menu page, to organise my posts "meal" under terms "cat\_meal". This terms should respect an order (dessert after starter for example). And that's my probleme : I tried so many sn...
Without knowing further details of your specific installation: 1. Make sure you are actually previewing live on the web in a browser to see if the short-code actually is working. 2. Make sure you have spelled the short-code correctly, and have the correct syntax. (See theme's documentation.) 3. If the short-code requi...
317,102
<p>I try to create a scheduled cron job which runs every hour, Its my first time working with wp-cron.</p> <p>In the cron function, I want to update post meta values, if some conditions are met.</p> <p>I also tested the code of the cron function outside of the cron to see/print the results. The results looked ok, but...
[ { "answer_id": 317114, "author": "Heres2u", "author_id": 140036, "author_profile": "https://wordpress.stackexchange.com/users/140036", "pm_score": 1, "selected": false, "text": "<p>Without knowing further details of your specific installation:</p>\n\n<ol>\n<li>Make sure you are actually ...
2018/10/19
[ "https://wordpress.stackexchange.com/questions/317102", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88895/" ]
I try to create a scheduled cron job which runs every hour, Its my first time working with wp-cron. In the cron function, I want to update post meta values, if some conditions are met. I also tested the code of the cron function outside of the cron to see/print the results. The results looked ok, but when the cronjob...
Without knowing further details of your specific installation: 1. Make sure you are actually previewing live on the web in a browser to see if the short-code actually is working. 2. Make sure you have spelled the short-code correctly, and have the correct syntax. (See theme's documentation.) 3. If the short-code requi...
317,113
<p>I added support for <code>align-wide</code> to my theme, but I don't know how to disable this feature for some existing blocks.</p> <p>I check <a href="https://wordpress.org/gutenberg/handbook/" rel="nofollow noreferrer">Gutenberg documentation</a> but I can't find solution.</p> <pre><code>add_theme_support( 'alig...
[ { "answer_id": 317239, "author": "Danny Cooper", "author_id": 111172, "author_profile": "https://wordpress.stackexchange.com/users/111172", "pm_score": 2, "selected": false, "text": "<p>Are you referring to blocks you've built yourself or existing blocks?</p>\n\n<p>If you are building yo...
2018/10/19
[ "https://wordpress.stackexchange.com/questions/317113", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133863/" ]
I added support for `align-wide` to my theme, but I don't know how to disable this feature for some existing blocks. I check [Gutenberg documentation](https://wordpress.org/gutenberg/handbook/) but I can't find solution. ``` add_theme_support( 'align-wide' ); ```
According to [the gutenberg handbook](https://wordpress.org/gutenberg/handbook/designers-developers/developers/filters/block-filters/#blocks-registerblocktype) you can use the `blocks.registerBlockType` filter which allows you to play around with the block settings. For most of the wp core blocks modifying the `suppor...
317,124
<p>I need some help with google indexing old PDF pages.</p> <p>Here is the situation:</p> <ul> <li>I have a new URL of <code>new.example.com</code>.</li> <li>The website was rebuilt and the company name has changed.</li> <li>The URL used to be <code>old.example.com</code>.</li> <li>It has been about 7 months since th...
[ { "answer_id": 317239, "author": "Danny Cooper", "author_id": 111172, "author_profile": "https://wordpress.stackexchange.com/users/111172", "pm_score": 2, "selected": false, "text": "<p>Are you referring to blocks you've built yourself or existing blocks?</p>\n\n<p>If you are building yo...
2018/10/19
[ "https://wordpress.stackexchange.com/questions/317124", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/146762/" ]
I need some help with google indexing old PDF pages. Here is the situation: * I have a new URL of `new.example.com`. * The website was rebuilt and the company name has changed. * The URL used to be `old.example.com`. * It has been about 7 months since the launch of the new website with the new URL. * Google is still ...
According to [the gutenberg handbook](https://wordpress.org/gutenberg/handbook/designers-developers/developers/filters/block-filters/#blocks-registerblocktype) you can use the `blocks.registerBlockType` filter which allows you to play around with the block settings. For most of the wp core blocks modifying the `suppor...
317,131
<p>i have this i answer in reference but seems have upvoted by many <a href="https://wordpress.stackexchange.com/a/48094/145078">https://wordpress.stackexchange.com/a/48094/145078</a></p> <p>but not sure why it is not working for me.. </p> <p>in answer </p> <pre><code> class MyClass { function __construc...
[ { "answer_id": 317133, "author": "phatskat", "author_id": 20143, "author_profile": "https://wordpress.stackexchange.com/users/20143", "pm_score": 0, "selected": false, "text": "<ol>\n<li>don't i have to set the visibility?</li>\n</ol>\n\n<p>You don't have to, but you should. Class proper...
2018/10/19
[ "https://wordpress.stackexchange.com/questions/317131", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
i have this i answer in reference but seems have upvoted by many <https://wordpress.stackexchange.com/a/48094/145078> but not sure why it is not working for me.. in answer ``` class MyClass { function __construct() { add_action( 'init',array( $this, 'getStuffDone' ) ); } ...
> > above code does not works for me, is not correct or any mistake from > my side? > > > And it didn't work for me either. Because it throws this fatal error: > > PHP Fatal error: No code may exist outside of namespace {} in ... > > > And that's because the PHP [manual](http://php.net/manual/en/language.na...
317,151
<p>I've created some shortcodes and for some of these, I need to load particular scripts on demand.</p> <p>I've included by default in my function.php file</p> <pre><code>vendor.js myscript.js </code></pre> <p>When i load the shortcode, i need to include a separate script between the two above (meaning that myscript...
[ { "answer_id": 317170, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": false, "text": "<p>Would <a href=\"https://codex.wordpress.org/Function_Reference/has_shortcode\" rel=\"nofollow norefe...
2018/10/20
[ "https://wordpress.stackexchange.com/questions/317151", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105978/" ]
I've created some shortcodes and for some of these, I need to load particular scripts on demand. I've included by default in my function.php file ``` vendor.js myscript.js ``` When i load the shortcode, i need to include a separate script between the two above (meaning that myscript.js requires the new script to be...
`wp_enqueue_script` is not going to work in a shortcode, this is because of the loading order. You could use `wp_register_script` and then you could `wp_enqueue_script` in you shortcode function like this example: ``` // Front-end function front_end_scripts() { wp_register_script( 'example-js', '//example.com/sha...
317,158
<p>On my home page I'd like to display the title and content from a few pages (about page, contact page, etc.). It looks like the template tag get_post can be used, but I'm not savvy enough with PHP to make it so. </p> <p>I found the code snippet below and it works.</p> <p><code>&lt;?php $id = 17; $po...
[ { "answer_id": 317170, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": false, "text": "<p>Would <a href=\"https://codex.wordpress.org/Function_Reference/has_shortcode\" rel=\"nofollow norefe...
2018/10/20
[ "https://wordpress.stackexchange.com/questions/317158", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152676/" ]
On my home page I'd like to display the title and content from a few pages (about page, contact page, etc.). It looks like the template tag get\_post can be used, but I'm not savvy enough with PHP to make it so. I found the code snippet below and it works. `<?php $id = 17; $post = get_page($id); $content = apply_...
`wp_enqueue_script` is not going to work in a shortcode, this is because of the loading order. You could use `wp_register_script` and then you could `wp_enqueue_script` in you shortcode function like this example: ``` // Front-end function front_end_scripts() { wp_register_script( 'example-js', '//example.com/sha...
317,175
<p>I've registered a widget</p> <pre><code>register_widget('Education_Work'); </code></pre> <p>Now can I call a widget by registered name? Is it possible ?</p> <pre><code>dynamic_sidebar('home-1'); // don't need this </code></pre> <p>I want something like <code>dynamic_sidebar('Education_Work');</code></p>
[ { "answer_id": 317183, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 2, "selected": false, "text": "<p>You would use <code>the_widget</code></p>\n<p><a href=\"https://codex.wordpress.org/Function_Reference/the_w...
2018/10/20
[ "https://wordpress.stackexchange.com/questions/317175", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152683/" ]
I've registered a widget ``` register_widget('Education_Work'); ``` Now can I call a widget by registered name? Is it possible ? ``` dynamic_sidebar('home-1'); // don't need this ``` I want something like `dynamic_sidebar('Education_Work');`
You would use `the_widget` <https://codex.wordpress.org/Function_Reference/the_widget> > > This template tag displays an arbitrary widget outside of a sidebar. It can be used anywhere in templates. > > > > ``` > <?php the_widget( $widget, $instance, $args ); ?> > > ``` > > e.g. `<?php the_widget( 'WP_Widget_...
317,176
<p>I am trying to schedule WP Cron that should run every midnight at Local Timestamp, but it is taking UTC only. This the code I am trying with,</p> <pre><code>if ( ! wp_next_scheduled( 'midnight_cron' ) ) { $now = current_time('timestamp', 1 ); $time = strtotime('tomorrow', $now ); wp_schedul...
[ { "answer_id": 317177, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>The <a href=\"https://codex.wordpress.org/Function_Reference/wp_schedule_event\" rel=\"nofollow nore...
2018/10/20
[ "https://wordpress.stackexchange.com/questions/317176", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/138263/" ]
I am trying to schedule WP Cron that should run every midnight at Local Timestamp, but it is taking UTC only. This the code I am trying with, ``` if ( ! wp_next_scheduled( 'midnight_cron' ) ) { $now = current_time('timestamp', 1 ); $time = strtotime('tomorrow', $now ); wp_schedule_event($time,...
Part 1. The Time != The Timestamp --------------------------------- [![enter image description here](https://i.stack.imgur.com/m2QtV.jpg)](https://i.stack.imgur.com/m2QtV.jpg) This is your problem: > > every midnight at Local Timestamp > > > There is no such thing as a local timestamp. Timestamps are not timezo...
317,185
<p>I recently updated my website after a while, and the custom fields meta box is not showing in the editor anymore. It isn't showing under "Screen Options" either. Any ideas why this could be, and how to get it back?</p> <p><a href="https://i.stack.imgur.com/XQXX6.png" rel="noreferrer"><img src="https://i.stack.imgur...
[ { "answer_id": 317187, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 0, "selected": false, "text": "<p>When registering a custom post type you have to declare that it supports the custom fields meta box to get i...
2018/10/20
[ "https://wordpress.stackexchange.com/questions/317185", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/50432/" ]
I recently updated my website after a while, and the custom fields meta box is not showing in the editor anymore. It isn't showing under "Screen Options" either. Any ideas why this could be, and how to get it back? [![enter image description here](https://i.stack.imgur.com/XQXX6.png)](https://i.stack.imgur.com/XQXX6.p...
It turns out the latest Advanced Custom Fields update (from version 5.6.0 on) removes the core custom fields metaboxes by default. The way to restore it was to add a filter in `functions.php`: ``` add_filter('acf/settings/remove_wp_meta_box', '__return_false'); ```
317,207
<h2>Background</h2> <p>My website is organised in a grid layout of four columns of divs. Each div is a container for a post and is a square of 200 x 200px. The title is a header at the bottom of the div and there is either an excerpt or a featured image above. Currently, if you click on either the excerpt text/feature...
[ { "answer_id": 317187, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 0, "selected": false, "text": "<p>When registering a custom post type you have to declare that it supports the custom fields meta box to get i...
2018/10/21
[ "https://wordpress.stackexchange.com/questions/317207", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152697/" ]
Background ---------- My website is organised in a grid layout of four columns of divs. Each div is a container for a post and is a square of 200 x 200px. The title is a header at the bottom of the div and there is either an excerpt or a featured image above. Currently, if you click on either the excerpt text/featured...
It turns out the latest Advanced Custom Fields update (from version 5.6.0 on) removes the core custom fields metaboxes by default. The way to restore it was to add a filter in `functions.php`: ``` add_filter('acf/settings/remove_wp_meta_box', '__return_false'); ```
317,250
<p>I am using a plugin, and to get around something I need to add some text to the excerpt field on my posts, but I don't want to display the excerpt field data on the front end, but rather the post content.</p> <p>Is there a way to stop wp from automatically showing the contents of the excerpt field? css won't work, ...
[ { "answer_id": 317257, "author": "ManzoorWani", "author_id": 113465, "author_profile": "https://wordpress.stackexchange.com/users/113465", "pm_score": 1, "selected": false, "text": "<p>If you want to always return post content when trying to get post excerpt, you can use <code>get_the_e...
2018/10/22
[ "https://wordpress.stackexchange.com/questions/317250", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151735/" ]
I am using a plugin, and to get around something I need to add some text to the excerpt field on my posts, but I don't want to display the excerpt field data on the front end, but rather the post content. Is there a way to stop wp from automatically showing the contents of the excerpt field? css won't work, as I want ...
If you want to always return post content when trying to get post excerpt, you can use `get_the_excerpt` filter like this. ``` add_filter( 'get_the_excerpt', 'wp256_use_content_as_excerpt', 10, 2 ); function wp256_use_content_as_excerpt( $excerpt, $post ) { return wp_strip_all_tags( $post->post_content ); } ```
317,256
<h2>How to UP Page Speed With Widget Defer?</h2> <p>Is there a way to <strong>defer</strong> a widget in the footer?</p> <p>I have an external API in a footer widget which is slowing down my <a href="https://lbryhub.com" rel="nofollow noreferrer">page</a>. It is not needed until the page is loaded.</p> <p>The cachin...
[ { "answer_id": 317476, "author": "cjbj", "author_id": 75495, "author_profile": "https://wordpress.stackexchange.com/users/75495", "pm_score": 2, "selected": false, "text": "<p>This has nothing to do with WordPress. It's about browser behaviour in loading scripts. You are right in noting ...
2018/10/22
[ "https://wordpress.stackexchange.com/questions/317256", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/148986/" ]
How to UP Page Speed With Widget Defer? --------------------------------------- Is there a way to **defer** a widget in the footer? I have an external API in a footer widget which is slowing down my [page](https://lbryhub.com). It is not needed until the page is loaded. The caching plugin I use (W3 Total Cache) give...
Your code shows an inline script, which adds a new script tag to the DOM, which probably slows down your website's loading time. This is not an inline script tag then. Try adding this line `s.defer = true;` after `s.async = true;` to add the `defer` attribute to your script tag. It should then look like this: ``` var ...
317,263
<p>I'm doing a redesign of the woocommerce dashboard.</p> <p>I had copy the dashboard.php from woocommerce folder to my theme folder.</p> <p>So now I want to get rid of the side menu from dashboard only(Remain on other pages eg. account detail page)</p> <p><a href="https://i.stack.imgur.com/OluYb.jpg" rel="nofollow ...
[ { "answer_id": 317476, "author": "cjbj", "author_id": 75495, "author_profile": "https://wordpress.stackexchange.com/users/75495", "pm_score": 2, "selected": false, "text": "<p>This has nothing to do with WordPress. It's about browser behaviour in loading scripts. You are right in noting ...
2018/10/22
[ "https://wordpress.stackexchange.com/questions/317263", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152730/" ]
I'm doing a redesign of the woocommerce dashboard. I had copy the dashboard.php from woocommerce folder to my theme folder. So now I want to get rid of the side menu from dashboard only(Remain on other pages eg. account detail page) [![enter image description here](https://i.stack.imgur.com/OluYb.jpg)](https://i.sta...
Your code shows an inline script, which adds a new script tag to the DOM, which probably slows down your website's loading time. This is not an inline script tag then. Try adding this line `s.defer = true;` after `s.async = true;` to add the `defer` attribute to your script tag. It should then look like this: ``` var ...
317,267
<p>I have a form like this:</p> <pre><code>&lt;form method="post" action="" id="BookingForm"&gt; &lt;label for="email"&gt;Email&lt;/label&gt; &lt;input type="text" name="email" id="emailId" value="" /&gt; &lt;input type="hidden" name="action" value="1" /&gt; &lt;input type="submit" name="submitname" va...
[ { "answer_id": 317268, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>The action seems to be incorrect on your Ajax call. As per the <a href=\"https://codex.wordpress.org...
2018/10/22
[ "https://wordpress.stackexchange.com/questions/317267", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152732/" ]
I have a form like this: ``` <form method="post" action="" id="BookingForm"> <label for="email">Email</label> <input type="text" name="email" id="emailId" value="" /> <input type="hidden" name="action" value="1" /> <input type="submit" name="submitname" value="Send" /> </form> <div id="container"></div...
It looks like the `MBAjax.ajaxurl` and `MBAjax.admin_url` are probably not set. If it can't post to the correct Wordpress handler, then you will probably get a 404 page HTML returned instead of the PHP function return value. You can test by hard-coding the ajax url to `url: "/wp-admin/admin-ajax.php",` and see if that...
317,277
<p>I'm looking for a way to get a post content and show it dynamically in a div.</p> <p>My posts are shown in a list on the left of the screen, and i'd like to show the one you click in the right part of the screen (i just need the HTML, since i want to apply another style than the single.php file).</p> <p>I searched...
[ { "answer_id": 317300, "author": "Alexander Holsgrove", "author_id": 48962, "author_profile": "https://wordpress.stackexchange.com/users/48962", "pm_score": 0, "selected": false, "text": "<p>This question is asking for quite a lot of fundamental help, but essentially you would want to in...
2018/10/22
[ "https://wordpress.stackexchange.com/questions/317277", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152738/" ]
I'm looking for a way to get a post content and show it dynamically in a div. My posts are shown in a list on the left of the screen, and i'd like to show the one you click in the right part of the screen (i just need the HTML, since i want to apply another style than the single.php file). I searched on the web for w...
OK, I managed to make it work, here's how i did : Jquery part : ``` jQuery(".post-link").click(function(){ var post_id = jQuery(this).data('id'); jQuery.post( ajaxurl, { 'action': 'load_post_content', 'the_ID': post_id }, function(response){ ...
317,401
<p>I have a taxonomy that will be the brand, and the children’s items the template. <a href="https://i.stack.imgur.com/1G8PE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1G8PE.png" alt="enter image description here"></a></p> <p>I have a code in <code>single.php</code> to show the details.</p> <p...
[ { "answer_id": 317302, "author": "Alexander Holsgrove", "author_id": 48962, "author_profile": "https://wordpress.stackexchange.com/users/48962", "pm_score": 0, "selected": false, "text": "<p>Helpful if you shared the markup.</p>\n\n<p>You can always check to see what Google sees with the...
2018/10/23
[ "https://wordpress.stackexchange.com/questions/317401", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152831/" ]
I have a taxonomy that will be the brand, and the children’s items the template. [![enter image description here](https://i.stack.imgur.com/1G8PE.png)](https://i.stack.imgur.com/1G8PE.png) I have a code in `single.php` to show the details. ``` <div class="box2"> <div class="faixa"> <div cl...
If you are interested in a way to avoid the uncertainty (as Google will most likely never document what they’ll do in such a case, and it could change anytime, or depend on additional signals etc.): **Give both `Product` items the same URI as ID.** This conveys to consumers that both of the `Product` items are about ...
317,477
<p>I'm using a gift card plugin for my woocommerce shop and I would like to add a generated pdf file to allow customers to download the gift card as a pdf.</p> <p>The idea is to use TCpdf or Fpdf to generate the pdf and output it as a string. </p> <pre><code>// Close and output PDF document // This method has several...
[ { "answer_id": 317638, "author": "Friss", "author_id": 62392, "author_profile": "https://wordpress.stackexchange.com/users/62392", "pm_score": -1, "selected": false, "text": "<p>Usually I proceed like this</p>\n\n<pre><code>$attachment = array(filepath);\n</code></pre>\n\n<p>Where filepa...
2018/10/24
[ "https://wordpress.stackexchange.com/questions/317477", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152887/" ]
I'm using a gift card plugin for my woocommerce shop and I would like to add a generated pdf file to allow customers to download the gift card as a pdf. The idea is to use TCpdf or Fpdf to generate the pdf and output it as a string. ``` // Close and output PDF document // This method has several options, check the s...
It is possible to add an attachment using the standard 'wp\_mail' function, however you would need to hook into the `phpmailer_init` action to do so. Because this will require calling another function where you don't have any context, you may need to register the action function anonymously with the `use ( $attachment...
317,507
<p>How can I change the output display of my pagination? I have been trying for the past few hours to format the output of my pagination links (1,2,3, etc.) to resemble the below:</p> <p><a href="https://i.stack.imgur.com/aIWT5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aIWT5.png" alt="Paginati...
[ { "answer_id": 317558, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 1, "selected": false, "text": "<p>I could see that you are trying to achieve the following output:</p>\n\n<pre><code>&lt;div class=\"paginat...
2018/10/24
[ "https://wordpress.stackexchange.com/questions/317507", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151946/" ]
How can I change the output display of my pagination? I have been trying for the past few hours to format the output of my pagination links (1,2,3, etc.) to resemble the below: [![Pagination Screenshot - GOAL](https://i.stack.imgur.com/aIWT5.png)](https://i.stack.imgur.com/aIWT5.png) I have been unable to modify the ...
The following will loop through a custom taxonomy and pull all the associated terms. ``` <?php if ( get_query_var( 'paged' ) ) { $page = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; } $per_page = 9; $totalterms = wp_count_terms( 'series' ); $totalpages = ceil( $totalterms ...
317,518
<p>With template builders like Divi and Elementor, is hand coding still required? We are building a B2B website on WordPress and there are no transactions involved in it. Our content will vary from page to page.</p>
[ { "answer_id": 317558, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 1, "selected": false, "text": "<p>I could see that you are trying to achieve the following output:</p>\n\n<pre><code>&lt;div class=\"paginat...
2018/10/24
[ "https://wordpress.stackexchange.com/questions/317518", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152912/" ]
With template builders like Divi and Elementor, is hand coding still required? We are building a B2B website on WordPress and there are no transactions involved in it. Our content will vary from page to page.
The following will loop through a custom taxonomy and pull all the associated terms. ``` <?php if ( get_query_var( 'paged' ) ) { $page = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; } $per_page = 9; $totalterms = wp_count_terms( 'series' ); $totalpages = ceil( $totalterms ...
317,530
<p>Hi guys so I have some data hitting my WP from an external company at /wp-json/wp/v2/jobs/ to be imported as a post.</p> <p>This data contains JSON that needs to be imported, however it tried to set taxonomies using strings e.g. "Manager" rather than the term_id which would be say "381". This means I get an error r...
[ { "answer_id": 317531, "author": "BenB", "author_id": 62909, "author_profile": "https://wordpress.stackexchange.com/users/62909", "pm_score": 2, "selected": false, "text": "<p>Seems like you looking for the <a href=\"https://developer.wordpress.org/reference/hooks/rest_pre_dispatch/\" re...
2018/10/24
[ "https://wordpress.stackexchange.com/questions/317530", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81335/" ]
Hi guys so I have some data hitting my WP from an external company at /wp-json/wp/v2/jobs/ to be imported as a post. This data contains JSON that needs to be imported, however it tried to set taxonomies using strings e.g. "Manager" rather than the term\_id which would be say "381". This means I get an error returned. ...
Using the `rest_pre_dispatch` hook is probably the most straightforward way to go, but you need to be careful about putting your new request data back into the `WP_REST_Request` object properly. You were reassigning the `WP_REST_Request` object to an array of request data. Those changes are not persisted because the p...
317,562
<p>With <code>define('WP_DEBUG', true);</code> in wp-config.php, I get the following notice:</p> <blockquote> <p>Constant EMPTY_TRASH_DAYS already defined in /wp-config.php on line 83</p> </blockquote> <p>I have checked this file, and this constant is defined just once. I've also searched through all of the php fil...
[ { "answer_id": 317569, "author": "ManzoorWani", "author_id": 113465, "author_profile": "https://wordpress.stackexchange.com/users/113465", "pm_score": -1, "selected": false, "text": "<p>It means that the constant <code>EMPTY_TRASH_DAYS</code> has been defined twice. You need to check and...
2018/10/25
[ "https://wordpress.stackexchange.com/questions/317562", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34991/" ]
With `define('WP_DEBUG', true);` in wp-config.php, I get the following notice: > > Constant EMPTY\_TRASH\_DAYS already defined in /wp-config.php on line 83 > > > I have checked this file, and this constant is defined just once. I've also searched through all of the php files on the server and don't see that it's ...
When defining any WordPress constants in wp-config.php you need to do it before this line: ``` require_once( ABSPATH . 'wp-settings.php' ); ``` That line loads many of WordPress’s default constants, and if you haven’t already defined them yourself then they’ll be defined in that line, meaning that any of them that ...
317,577
<p>How can I get a total word count of one author's posts? Thanks.</p> <p>To be more clear, I wanna show the total word count in the author archive page, preferably using code.</p>
[ { "answer_id": 317578, "author": "cgs themes", "author_id": 152960, "author_profile": "https://wordpress.stackexchange.com/users/152960", "pm_score": 0, "selected": false, "text": "<p>Tools to Manage Your WordPress Word Count</p>\n\n<p>PublishPress is a great WordPress plugin for content...
2018/10/25
[ "https://wordpress.stackexchange.com/questions/317577", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152235/" ]
How can I get a total word count of one author's posts? Thanks. To be more clear, I wanna show the total word count in the author archive page, preferably using code.
Here's a basic concept how I'd do the word counting and showing the count. Hopefully this serves as a starting point. I think it would be a good idea to store the word count in a [transient](https://codex.wordpress.org/Transients_API), so it isn't calculated on each and every author archive page load. ``` function au...
317,606
<p>I have a multisite network, where the admins of each site are able to add users to their site. My problem is that if they select the same username it will not work.</p> <p>So I am thinking if it is possible to save the Username field with a prefix. Say the admin adds a user called <code>johndoe</code> to a site cal...
[ { "answer_id": 317709, "author": "Nikolay", "author_id": 100555, "author_profile": "https://wordpress.stackexchange.com/users/100555", "pm_score": 0, "selected": false, "text": "<p>I am not sure that they would like that prefix, maybe they would prefer to come up with a new username that...
2018/10/25
[ "https://wordpress.stackexchange.com/questions/317606", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143279/" ]
I have a multisite network, where the admins of each site are able to add users to their site. My problem is that if they select the same username it will not work. So I am thinking if it is possible to save the Username field with a prefix. Say the admin adds a user called `johndoe` to a site called `mysite` then the...
I have noticed that the code our friend shares has an error. Add the prefix twice. I share other code with this error resolved. ``` <?php add_filter( 'pre_user_login', 'sneakily_add_prefix_to_username' ); function sneakily_add_prefix_to_username( $username ) { if ( ! current_user_can( 'manage_network' ) ) { ...
317,622
<p>I created a function in function.php which send an email with user information at registration. I succeed to get the ID but I can't get custom fields... I only can get these ones : - ID - user_login - user_pass - user_nicename - user_email - user_url - user_registered - display_name</...
[ { "answer_id": 317625, "author": "Friss", "author_id": 62392, "author_profile": "https://wordpress.stackexchange.com/users/62392", "pm_score": 1, "selected": false, "text": "<p><strong>EDIT</strong></p>\n\n<p>I think the solution given by @dboris may work.\nAlternatively you could try to...
2018/10/25
[ "https://wordpress.stackexchange.com/questions/317622", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152992/" ]
I created a function in function.php which send an email with user information at registration. I succeed to get the ID but I can't get custom fields... I only can get these ones : - ID - user\_login - user\_pass - user\_nicename - user\_email - user\_url - user\_registered - display\_name I can't either get t...
**EDIT** I think the solution given by @dboris may work. Alternatively you could try to hook your email sending after the user registration like this ``` global $uID; //to keep the value to reuse it later, null at this step function mailInscriptionSecteurRhone() { global $uID; $user_ID = $uID; $headers = array('...
317,634
<p>I have been killing myself trying to figure this out on my own. And I for the life of me cannot figure out what is causing my issues.</p> <p>I created a template for the testimonials page and used custom post types to fill the content. Everything looks great until I add the side bar then it creates a big gap the ...
[ { "answer_id": 317625, "author": "Friss", "author_id": 62392, "author_profile": "https://wordpress.stackexchange.com/users/62392", "pm_score": 1, "selected": false, "text": "<p><strong>EDIT</strong></p>\n\n<p>I think the solution given by @dboris may work.\nAlternatively you could try to...
2018/10/25
[ "https://wordpress.stackexchange.com/questions/317634", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152991/" ]
I have been killing myself trying to figure this out on my own. And I for the life of me cannot figure out what is causing my issues. I created a template for the testimonials page and used custom post types to fill the content. Everything looks great until I add the side bar then it creates a big gap the length of th...
**EDIT** I think the solution given by @dboris may work. Alternatively you could try to hook your email sending after the user registration like this ``` global $uID; //to keep the value to reuse it later, null at this step function mailInscriptionSecteurRhone() { global $uID; $user_ID = $uID; $headers = array('...
317,747
<p>I have categories Cats, Dogs and Rabbits.</p> <p>I would like to change the link used for "dogs" when listing category on the front end to a custom page instead of the category archive.</p>
[ { "answer_id": 317752, "author": "SCor", "author_id": 65273, "author_profile": "https://wordpress.stackexchange.com/users/65273", "pm_score": -1, "selected": false, "text": "<p>Depending on how you display categories, you could create a menu where the link to Dogs is a page, instead of t...
2018/10/27
[ "https://wordpress.stackexchange.com/questions/317747", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/153091/" ]
I have categories Cats, Dogs and Rabbits. I would like to change the link used for "dogs" when listing category on the front end to a custom page instead of the category archive.
Your goal seems to be to change the link which is output when listing the categories rather than making the existing link point to a different page as my last answer assumed. So I am going to try a different answer with a different solution. Using the filter `term_link` in the function [`get_term_link()`](https://deve...
317,836
<p>I'm using the WP REST API v2 to try and search for all posts with the same title, what I'm trying to do is create a sort of head-to-head/previous meetings page for 2 teams.</p> <p>At the moment i can retrieve a single post with a slug no problem </p> <pre><code>.../wp-json/sportspress/v2/events?slug=team1-vs-team2...
[ { "answer_id": 395256, "author": "Rajeev Singh", "author_id": 209620, "author_profile": "https://wordpress.stackexchange.com/users/209620", "pm_score": 0, "selected": false, "text": "<p>Unfortunately, it is not possible, but you can use slug instead.</p>\n<p>Like this:</p>\n<pre><code>ht...
2018/10/28
[ "https://wordpress.stackexchange.com/questions/317836", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/153157/" ]
I'm using the WP REST API v2 to try and search for all posts with the same title, what I'm trying to do is create a sort of head-to-head/previous meetings page for 2 teams. At the moment i can retrieve a single post with a slug no problem ``` .../wp-json/sportspress/v2/events?slug=team1-vs-team2 ``` When i use a s...
Of course it's possible! You'll just need to add in a custom endpoint for the REST API. To do that, drop the code below into your functions.php (or better yet, a plugin so it's not tied to your theme). First, register the custom route and allow it to take a "title" parameter. ``` /** * Register the custom route * ...
317,883
<p>I'm currently writing a plugin in which users can select whether they want to insert a google analytics tag or a GTM tag (Google tag manager). I've already figured out how to insert the code after the tag.</p> <p>At the moment the code gets inserted through a custom function in my theme's <code>function.php</code>...
[ { "answer_id": 317890, "author": "cjbj", "author_id": 75495, "author_profile": "https://wordpress.stackexchange.com/users/75495", "pm_score": 3, "selected": true, "text": "<p>Since you want your plugin to be theme independent you will have to rely on hooks that you may assume are there i...
2018/10/29
[ "https://wordpress.stackexchange.com/questions/317883", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/153191/" ]
I'm currently writing a plugin in which users can select whether they want to insert a google analytics tag or a GTM tag (Google tag manager). I've already figured out how to insert the code after the tag. At the moment the code gets inserted through a custom function in my theme's `function.php` and calling the funct...
Since you want your plugin to be theme independent you will have to rely on hooks that you may assume are there in any decently made theme. At the moment you can only rely on `wp_head` and `wp_footer`. A hook right after the `<body>` tag [is under discussion](https://core.trac.wordpress.org/ticket/12563), but even if i...
317,896
<p>After cloning my wordpress site and fresh install of it i encountered problem. Plugins won't update. I'm working in Linux environment (Ubuntu). I've tried multiple solutions but still without positive result.</p> <p>First of all i set all permissions for installation folder with <code>chmod -R 777 .</code></p> <p>...
[ { "answer_id": 317924, "author": "Heres2u", "author_id": 140036, "author_profile": "https://wordpress.stackexchange.com/users/140036", "pm_score": 1, "selected": false, "text": "<p>I have Wordpress on Unbutu as well. Maybe this will get you started. (I'm assuming you have access with c...
2018/10/29
[ "https://wordpress.stackexchange.com/questions/317896", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/140315/" ]
After cloning my wordpress site and fresh install of it i encountered problem. Plugins won't update. I'm working in Linux environment (Ubuntu). I've tried multiple solutions but still without positive result. First of all i set all permissions for installation folder with `chmod -R 777 .` Then i set `define('FS_METHO...
I have Wordpress on Unbutu as well. Maybe this will get you started. (I'm assuming you have access with command line through Terminal via SSH. If that assumption is in error, forgive me.) In a typical Wordpress install there are likely three users, similar to: ``` root:root www-data:www-data (Apache) user:user sudo...
317,898
<p>Wordpress 4.9.8 when I save a draft/publish return me an error:</p> <pre><code> Gone The requested resource /wp-admin/post.php is no longer available on this server and there is no forwarding address. Please remove all references to this resource. </code></pre> <p>I found that the problem is because my text ha...
[ { "answer_id": 317901, "author": "André Kelling", "author_id": 136930, "author_profile": "https://wordpress.stackexchange.com/users/136930", "pm_score": 0, "selected": false, "text": "<p>in general it's not a good idea to insert inline styles. </p>\n\n<p>try with a CSS class and add your...
2018/10/29
[ "https://wordpress.stackexchange.com/questions/317898", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150879/" ]
Wordpress 4.9.8 when I save a draft/publish return me an error: ``` Gone The requested resource /wp-admin/post.php is no longer available on this server and there is no forwarding address. Please remove all references to this resource. ``` I found that the problem is because my text has " style="bla bla bla" "....
I've had the same issue recently. Inline styles, as well as `<img>` tags, would cause the `410 Gone` status and error message (`The requested resource /wp-admin/post.php is no longer available on this server and there is no forwarding address. Please remove all references to this resource.` upon previewing or publish...
317,927
<p>I'd like to get a list of all the custom posts that belong to a specific taxonomy.</p> <p>I've tried many things including this code, but I get a list of all the posts in the 'members' cpt, and not just posts associated to the 'producers' taxonomy. How can I get it work ?</p> <pre><code>&lt;?php $args = array( ...
[ { "answer_id": 317901, "author": "André Kelling", "author_id": 136930, "author_profile": "https://wordpress.stackexchange.com/users/136930", "pm_score": 0, "selected": false, "text": "<p>in general it's not a good idea to insert inline styles. </p>\n\n<p>try with a CSS class and add your...
2018/10/29
[ "https://wordpress.stackexchange.com/questions/317927", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/147708/" ]
I'd like to get a list of all the custom posts that belong to a specific taxonomy. I've tried many things including this code, but I get a list of all the posts in the 'members' cpt, and not just posts associated to the 'producers' taxonomy. How can I get it work ? ``` <?php $args = array( 'post_type' => 'mem...
I've had the same issue recently. Inline styles, as well as `<img>` tags, would cause the `410 Gone` status and error message (`The requested resource /wp-admin/post.php is no longer available on this server and there is no forwarding address. Please remove all references to this resource.` upon previewing or publish...