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 |
|---|---|---|---|---|---|---|
360,410 | <p>If I try to upgrade to PHP 7 or up (from 5.6), I have one site that is throwing a PHP error. </p>
<p>I have tried uninstalling all plugins and activating the Twenty Twenty theme before changing PHP version. No dice.</p>
<p>Is there a setting in the database or core that would be effecting this? I also tried a defa... | [
{
"answer_id": 360414,
"author": "ngearing",
"author_id": 50184,
"author_profile": "https://wordpress.stackexchange.com/users/50184",
"pm_score": 2,
"selected": true,
"text": "<p>Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have... | 2020/03/10 | [
"https://wordpress.stackexchange.com/questions/360410",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117675/"
] | If I try to upgrade to PHP 7 or up (from 5.6), I have one site that is throwing a PHP error.
I have tried uninstalling all plugins and activating the Twenty Twenty theme before changing PHP version. No dice.
Is there a setting in the database or core that would be effecting this? I also tried a default .htaccess fil... | Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have their own separate git repos.
Here is the source for the Latest Posts Block:
<https://github.com/WordPress/gutenberg/tree/master/packages/block-library/src/latest-posts> |
360,428 | <p>I understand that the <code>auth_redirect()</code> checks if a user is logged in, if not it redirects them to the login page then come back to the previous page on success. I need that functionality on my website and I have that.</p>
<p>For example, I wanted one of the pages to access only by logged in users, if th... | [
{
"answer_id": 360414,
"author": "ngearing",
"author_id": 50184,
"author_profile": "https://wordpress.stackexchange.com/users/50184",
"pm_score": 2,
"selected": true,
"text": "<p>Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have... | 2020/03/11 | [
"https://wordpress.stackexchange.com/questions/360428",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/192520/"
] | I understand that the `auth_redirect()` checks if a user is logged in, if not it redirects them to the login page then come back to the previous page on success. I need that functionality on my website and I have that.
For example, I wanted one of the pages to access only by logged in users, if they tried to access th... | Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have their own separate git repos.
Here is the source for the Latest Posts Block:
<https://github.com/WordPress/gutenberg/tree/master/packages/block-library/src/latest-posts> |
360,431 | <p>I am working on custom development in wordpress, my problem is the following every time I create a new template.</p>
<p><b>Code</b></p>
<pre><code> /* Template Name: Citas Rolex*/
get_header();
echo "<h1>loren ipsum</h1>";
get_footer();
</code></pre>
<p>It gives me the following error in the user v... | [
{
"answer_id": 360414,
"author": "ngearing",
"author_id": 50184,
"author_profile": "https://wordpress.stackexchange.com/users/50184",
"pm_score": 2,
"selected": true,
"text": "<p>Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have... | 2020/03/11 | [
"https://wordpress.stackexchange.com/questions/360431",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/182606/"
] | I am working on custom development in wordpress, my problem is the following every time I create a new template.
**Code**
```
/* Template Name: Citas Rolex*/
get_header();
echo "<h1>loren ipsum</h1>";
get_footer();
```
It gives me the following error in the user view
**In browser**
>
> Internal Server Error ... | Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have their own separate git repos.
Here is the source for the Latest Posts Block:
<https://github.com/WordPress/gutenberg/tree/master/packages/block-library/src/latest-posts> |
360,441 | <p>I need to dublicate all existing routes with several language codes:</p>
<pre><code>/2020/03/11/Hello-world
/en/2020/03/11/Hello-world
/de/2020/03/11/Hello-world
/Hello-world-page
/en/Hello-world-page
/de/Hello-world-page
/...
/en/...
/de/...
</code></pre>
<p>Then I need to pre-handle all routes to check prefix ... | [
{
"answer_id": 360414,
"author": "ngearing",
"author_id": 50184,
"author_profile": "https://wordpress.stackexchange.com/users/50184",
"pm_score": 2,
"selected": true,
"text": "<p>Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have... | 2020/03/11 | [
"https://wordpress.stackexchange.com/questions/360441",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/26048/"
] | I need to dublicate all existing routes with several language codes:
```
/2020/03/11/Hello-world
/en/2020/03/11/Hello-world
/de/2020/03/11/Hello-world
/Hello-world-page
/en/Hello-world-page
/de/Hello-world-page
/...
/en/...
/de/...
```
Then I need to pre-handle all routes to check prefix exists and get as slug, th... | Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have their own separate git repos.
Here is the source for the Latest Posts Block:
<https://github.com/WordPress/gutenberg/tree/master/packages/block-library/src/latest-posts> |
360,452 | <p>In my blog index page I do not want to show posts which has empty content but only title (<a href="https://wordpress.stackexchange.com/questions/37686/how-does-filter-the-posts-work">How does filter the_posts work?</a>) . I am looking at 'the_post' hook which seems to fire inside the loop . So , I thought if the act... | [
{
"answer_id": 360414,
"author": "ngearing",
"author_id": 50184,
"author_profile": "https://wordpress.stackexchange.com/users/50184",
"pm_score": 2,
"selected": true,
"text": "<p>Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have... | 2020/03/11 | [
"https://wordpress.stackexchange.com/questions/360452",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/170935/"
] | In my blog index page I do not want to show posts which has empty content but only title ([How does filter the\_posts work?](https://wordpress.stackexchange.com/questions/37686/how-does-filter-the-posts-work)) . I am looking at 'the\_post' hook which seems to fire inside the loop . So , I thought if the action hook is ... | Gutenberg blocks are not stored in the Wordpress files in a readable or debuggable format. Instead, they have their own separate git repos.
Here is the source for the Latest Posts Block:
<https://github.com/WordPress/gutenberg/tree/master/packages/block-library/src/latest-posts> |
360,481 | <p>How can I run a wp cli command when a wordpress hook is called on my website.</p>
<p>On user registration hook, I would like to run a wp cli command to activate a license.</p>
| [
{
"answer_id": 360792,
"author": "Tom Anderson",
"author_id": 171472,
"author_profile": "https://wordpress.stackexchange.com/users/171472",
"pm_score": 1,
"selected": false,
"text": "<p>Depends on what you want to do. If you want to run the PHP code that's behind the WP-CLI code you migh... | 2020/03/11 | [
"https://wordpress.stackexchange.com/questions/360481",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184151/"
] | How can I run a wp cli command when a wordpress hook is called on my website.
On user registration hook, I would like to run a wp cli command to activate a license. | Depends on what you want to do. If you want to run the PHP code that's behind the WP-CLI code you might consider looking at <https://github.com/wp-cli/entity-command>
Maybe you don't actually need WP-CLI but the corresponding code behind it. Most WP-CLI commands have Wordpress equivalents. For example of what I was tr... |
360,490 | <p>I have a site that uses categories to output posts into categories.php. I don't have single posts using single.php </p>
<p>What I need is for a 'next 10' / 'previous 10' links in the category a site visitor is looking at. Here's my code from category.php</p>
<pre><code><?php if (is_category('black-metal')) : ?&... | [
{
"answer_id": 360792,
"author": "Tom Anderson",
"author_id": 171472,
"author_profile": "https://wordpress.stackexchange.com/users/171472",
"pm_score": 1,
"selected": false,
"text": "<p>Depends on what you want to do. If you want to run the PHP code that's behind the WP-CLI code you migh... | 2020/03/11 | [
"https://wordpress.stackexchange.com/questions/360490",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35299/"
] | I have a site that uses categories to output posts into categories.php. I don't have single posts using single.php
What I need is for a 'next 10' / 'previous 10' links in the category a site visitor is looking at. Here's my code from category.php
```
<?php if (is_category('black-metal')) : ?>
<h2><img src="<?php blo... | Depends on what you want to do. If you want to run the PHP code that's behind the WP-CLI code you might consider looking at <https://github.com/wp-cli/entity-command>
Maybe you don't actually need WP-CLI but the corresponding code behind it. Most WP-CLI commands have Wordpress equivalents. For example of what I was tr... |
360,497 | <p>I try to create a new "Post" kind of group that can be used as a different list to display different info. Someone already created two for us, but I don't know how. can someone teach me how? Thanks</p>
<p><a href="https://i.stack.imgur.com/GDK8H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GDK... | [
{
"answer_id": 360792,
"author": "Tom Anderson",
"author_id": 171472,
"author_profile": "https://wordpress.stackexchange.com/users/171472",
"pm_score": 1,
"selected": false,
"text": "<p>Depends on what you want to do. If you want to run the PHP code that's behind the WP-CLI code you migh... | 2020/03/12 | [
"https://wordpress.stackexchange.com/questions/360497",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184163/"
] | I try to create a new "Post" kind of group that can be used as a different list to display different info. Someone already created two for us, but I don't know how. can someone teach me how? Thanks
[](https://i.stack.imgur.com/GDK8H.png) | Depends on what you want to do. If you want to run the PHP code that's behind the WP-CLI code you might consider looking at <https://github.com/wp-cli/entity-command>
Maybe you don't actually need WP-CLI but the corresponding code behind it. Most WP-CLI commands have Wordpress equivalents. For example of what I was tr... |
360,521 | <p>All of my categories has a custom single post title type, such:
"How to TITLE Free"
and then the article.</p>
<p>I want to get another title if category is News. So i won't have "How To TITLE Free" for single posts titles, but instead I will have "TITLE" only.</p>
<p>How can I do this?
Thank you.</p>
| [
{
"answer_id": 360537,
"author": "Siddhesh Shirodkar",
"author_id": 163787,
"author_profile": "https://wordpress.stackexchange.com/users/163787",
"pm_score": 0,
"selected": false,
"text": "<p>use get_the_category() to get category of posts.\nCompare it with your required category like:</... | 2020/03/12 | [
"https://wordpress.stackexchange.com/questions/360521",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/114258/"
] | All of my categories has a custom single post title type, such:
"How to TITLE Free"
and then the article.
I want to get another title if category is News. So i won't have "How To TITLE Free" for single posts titles, but instead I will have "TITLE" only.
How can I do this?
Thank you. | change this one line in your code:
```
<h1 class="article-title entry-title">How To <?php the_title(); ?> Free</h1>
```
to:
CORRECTION:
```
<h1 class="article-title entry-title"><?php if( in_category( array('news') ) ) { the_title(); } else { ?> How To <?php the_title(); ?> Free<?php } ?></h1>
```
<https://develo... |
360,535 | <p>How can i update global variable URL? I am trying for the last 3 days, still no luck </p>
<pre><code>var output = '';
var pageNum = '';
url = '';
function post_ajax_get(pagination) {
$("#loading-animation").show();
var query = 'nazwa=';
var time = 'gr=';
var output = '';
$("[data-category-menu] ... | [
{
"answer_id": 360524,
"author": "Mikhail",
"author_id": 88888,
"author_profile": "https://wordpress.stackexchange.com/users/88888",
"pm_score": 2,
"selected": false,
"text": "<p>There can be a case that theme implements hooks via <code>do_action(\"action_name\"</code>) but it's not forc... | 2020/03/12 | [
"https://wordpress.stackexchange.com/questions/360535",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184176/"
] | How can i update global variable URL? I am trying for the last 3 days, still no luck
```
var output = '';
var pageNum = '';
url = '';
function post_ajax_get(pagination) {
$("#loading-animation").show();
var query = 'nazwa=';
var time = 'gr=';
var output = '';
$("[data-category-menu] a.current").ea... | There can be a case that theme implements hooks via `do_action("action_name"`) but it's not forced to bind actual actions to it, as theme's developers might just did it to make theme more extensible, and in fact never use it inside theme.
So you can just bind your own code via `add_action("colormag_before", "your_func... |
360,573 | <p>Stack Exchange long time listener, first time caller.</p>
<p>I have found examples on the developer.wordpress site but I have been still struggling.</p>
<p>Localizing scripts:
<a href="https://developer.wordpress.org/reference/functions/wp_localize_script/#comment-content-1391" rel="nofollow noreferrer">wp_localiz... | [
{
"answer_id": 360524,
"author": "Mikhail",
"author_id": 88888,
"author_profile": "https://wordpress.stackexchange.com/users/88888",
"pm_score": 2,
"selected": false,
"text": "<p>There can be a case that theme implements hooks via <code>do_action(\"action_name\"</code>) but it's not forc... | 2020/03/12 | [
"https://wordpress.stackexchange.com/questions/360573",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184205/"
] | Stack Exchange long time listener, first time caller.
I have found examples on the developer.wordpress site but I have been still struggling.
Localizing scripts:
[wp\_localize\_script()](https://developer.wordpress.org/reference/functions/wp_localize_script/#comment-content-1391)
In my theme's functions.php file, I ... | There can be a case that theme implements hooks via `do_action("action_name"`) but it's not forced to bind actual actions to it, as theme's developers might just did it to make theme more extensible, and in fact never use it inside theme.
So you can just bind your own code via `add_action("colormag_before", "your_func... |
360,593 | <p>Can't get my checkbox for metafield set true by default.</p>
<p>Everything is working fine, except default value.</p>
<p>I know there is a lot of questions and answers for it,</p>
<p>But I tried everything and still can't get it.</p>
<p>Here is my code:</p>
<pre><code>function theme_add_meta_box() {
add_met... | [
{
"answer_id": 360590,
"author": "Fredy31",
"author_id": 8895,
"author_profile": "https://wordpress.stackexchange.com/users/8895",
"pm_score": 2,
"selected": false,
"text": "<p>Well, I'm a moron. It's under Settings->URL Modifications... the 'The front page url contains the language code... | 2020/03/12 | [
"https://wordpress.stackexchange.com/questions/360593",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/182186/"
] | Can't get my checkbox for metafield set true by default.
Everything is working fine, except default value.
I know there is a lot of questions and answers for it,
But I tried everything and still can't get it.
Here is my code:
```
function theme_add_meta_box() {
add_meta_box( 'theme_post_sidebar_option', esc_ht... | Yes it is possible. For a more comprehensive answer, see: <https://polylang.pro/doc/define-your-home-page-as-a-static-page/> |
360,596 | <p>I want security for my theme, so I took all different commands from my theme files.
If I need to escape these, how can I do it? :</p>
<pre><code><?php get_header(); ?>
<h1><?php _e( 'Page not found', 'html5blank' ); ?></h1>
<a href="<?php echo home_url(); ?>">
<?php
... | [
{
"answer_id": 360598,
"author": "uPrompt",
"author_id": 155077,
"author_profile": "https://wordpress.stackexchange.com/users/155077",
"pm_score": -1,
"selected": false,
"text": "<p>Again, can't comment yet but I think this is what you're looking for:</p>\n\n<p><a href=\"https://wordpres... | 2020/03/12 | [
"https://wordpress.stackexchange.com/questions/360596",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/172430/"
] | I want security for my theme, so I took all different commands from my theme files.
If I need to escape these, how can I do it? :
```
<?php get_header(); ?>
<h1><?php _e( 'Page not found', 'html5blank' ); ?></h1>
<a href="<?php echo home_url(); ?>">
<?php
if ( $thumbnail_id = get_post_thumbnail_id() ) ... | Here's just a few examples of what escaping looks like:
**Escaping URLS:**
```
<?php echo esc_url( home_url() ); ?>
```
**Escaping Content**
```
<?php echo esc_html( get_the_title() ); ?>
```
**Escaping Attributes**
```
<?php echo esc_attr( $my_class ); ?>
```
**Escaping Content but keep HTML**
```
<?php ec... |
360,604 | <p>I dont know what is these mean so can you explain to fix it:</p>
<pre><code>class="home page-template-default page page-id-50 logged-in theme-html5blank-stable woocommerce-no-js ehf-header ehf-footer ehf-template-html5blank-stable ehf-stylesheet-html5blank-stable elementor-default elementor-kit-1715 elementor-page ... | [
{
"answer_id": 360607,
"author": "ahmet kaya",
"author_id": 172430,
"author_profile": "https://wordpress.stackexchange.com/users/172430",
"pm_score": 2,
"selected": false,
"text": "<p>Those are the classes echoed by <a href=\"https://developer.wordpress.org/reference/functions/body_class... | 2020/03/12 | [
"https://wordpress.stackexchange.com/questions/360604",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/172430/"
] | I dont know what is these mean so can you explain to fix it:
```
class="home page-template-default page page-id-50 logged-in theme-html5blank-stable woocommerce-no-js ehf-header ehf-footer ehf-template-html5blank-stable ehf-stylesheet-html5blank-stable elementor-default elementor-kit-1715 elementor-page elementor-page... | >
> It's Used to All class add to wordpress body element Using *body\_class();* function.
>
>
>
Specifically, it's used to adding body classes, removing body classes, conditionally adding body classes and some use cases.
>
> **The Body Class: What Can It Be Used For?**
>
>
>
The body class in WordPress is a ... |
360,609 | <p>I am new in WordPress. I would like to know more about wp_query. I have below code in my WordPress site. </p>
<pre><code>$metaquery = array(
'relation' => 'AND',
array(
'relation' => 'AND',
array(
... | [
{
"answer_id": 360612,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 2,
"selected": false,
"text": "<p><strong><em>Note (to other readers):</strong> If you are looking for a beginner-level guide on WordPress (... | 2020/03/13 | [
"https://wordpress.stackexchange.com/questions/360609",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/65189/"
] | I am new in WordPress. I would like to know more about wp\_query. I have below code in my WordPress site.
```
$metaquery = array(
'relation' => 'AND',
array(
'relation' => 'AND',
array(
'key' => '... | Basically meta\_query parameter of WP\_Query allows you to search WordPress posts / pages / custom post types by their meta data and sort the result.
In this post I assume that you already have basic knowledge how to work with WP\_Query class in WordPress. Before I begin, I want to show you some very simple examples. ... |
360,692 | <p>Hello everyone and I found you well, I have a problem with a dynamic site that contains over 200,000 photos, it is a news site. The site is built on the WordPress platform and has many changes to suit our business. In vain I complete the attribute alt for each photo he does not appear live. After many consultations ... | [
{
"answer_id": 360612,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 2,
"selected": false,
"text": "<p><strong><em>Note (to other readers):</strong> If you are looking for a beginner-level guide on WordPress (... | 2020/03/14 | [
"https://wordpress.stackexchange.com/questions/360692",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184266/"
] | Hello everyone and I found you well, I have a problem with a dynamic site that contains over 200,000 photos, it is a news site. The site is built on the WordPress platform and has many changes to suit our business. In vain I complete the attribute alt for each photo he does not appear live. After many consultations a c... | Basically meta\_query parameter of WP\_Query allows you to search WordPress posts / pages / custom post types by their meta data and sort the result.
In this post I assume that you already have basic knowledge how to work with WP\_Query class in WordPress. Before I begin, I want to show you some very simple examples. ... |
360,708 | <p>I want to write a class to the body of all pages posts and custom posts (IE entire site)</p>
<p>I am using a front end editor that allows logged in users to edit posts and keep them out of the back-end.</p>
<ul>
<li>I have a custom post-type "emergency status"</li>
<li>It contains one post with a taxonomy "status"... | [
{
"answer_id": 360711,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 0,
"selected": false,
"text": "<p>WordPress already does this if your theme has been built correctly. Specifically, WP will add classes to the... | 2020/03/14 | [
"https://wordpress.stackexchange.com/questions/360708",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/125332/"
] | I want to write a class to the body of all pages posts and custom posts (IE entire site)
I am using a front end editor that allows logged in users to edit posts and keep them out of the back-end.
* I have a custom post-type "emergency status"
* It contains one post with a taxonomy "status"
* It has the terms extreme,... | >
> * You can use the body\_class filter in WordPress to add the Taxonomy Terms of a Custom Taxonomy as CSS classes to a post. The CSS class appears in the body element and is only used if the post has been assigned to the taxonomy.
> * The code goes in your functions.php file.
>
>
>
```
add_filter( 'body_class', ... |
360,709 | <p>I have two coupons, one $10 another $5. I want do next, if price be less $50 and customer enter discount coupon $10 replace this coupon by coupon $5.</p>
<p><strong>Example:</strong></p>
<p>The customer added an item in cart with total price $40 and he applied the coupon $10-Off. Now I need replace current coupon ... | [
{
"answer_id": 360977,
"author": "Dragos Micu",
"author_id": 110131,
"author_profile": "https://wordpress.stackexchange.com/users/110131",
"pm_score": 0,
"selected": false,
"text": "<p>I have tested this and can confirm that it works, even after you change the products in the cart to be ... | 2020/03/14 | [
"https://wordpress.stackexchange.com/questions/360709",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/51770/"
] | I have two coupons, one $10 another $5. I want do next, if price be less $50 and customer enter discount coupon $10 replace this coupon by coupon $5.
**Example:**
The customer added an item in cart with total price $40 and he applied the coupon $10-Off. Now I need replace current coupon with $10-Off to my another cou... | This requires to use an action hook like `woocommerce_calculate_totals` that is related to cart and **Ajax enabled**, because it will handle all changes made by the customer in cart page:
```
add_action( 'woocommerce_calculate_totals', 'discount_based_on_cart_subtotal', 10, 1 );
function discount_based_on_cart_subtota... |
360,721 | <p>I'm writing a simple plugin that shows on pages/posts a form with customized style for input fields, checkboxes, buttons, etc... via a shortcode. When user writes the shortcode in the page, it generates some CSS, some HTML and some JavaScript but result is not rendered as I want I think because of active theme CSS.
... | [
{
"answer_id": 360739,
"author": "Davood Denavi",
"author_id": 184294,
"author_profile": "https://wordpress.stackexchange.com/users/184294",
"pm_score": -1,
"selected": false,
"text": "<p>I'd suggest looking at using a custom theme if you want to ignore CSS from your theme and them using... | 2020/03/14 | [
"https://wordpress.stackexchange.com/questions/360721",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178523/"
] | I'm writing a simple plugin that shows on pages/posts a form with customized style for input fields, checkboxes, buttons, etc... via a shortcode. When user writes the shortcode in the page, it generates some CSS, some HTML and some JavaScript but result is not rendered as I want I think because of active theme CSS.
In ... | You can make sure that your CSS is [enqueued](https://developer.wordpress.org/reference/functions/wp_enqueue_style/) after your theme's CSS and also make sure that your CSS is using rules that are more specific. This will help in making your CSS override the theme's CSS.
Worse-case scenario you could add !important to... |
360,745 | <p>I asked a <a href="https://wordpress.stackexchange.com/questions/360418/enhancing-gutenberg-featured-image-control">previous question</a>, and got a helpful answer that got me going quite a ways. The present problem is unrelated, but IMO reflects the dearth of documentation suitable for those of us who aren't famili... | [
{
"answer_id": 360739,
"author": "Davood Denavi",
"author_id": 184294,
"author_profile": "https://wordpress.stackexchange.com/users/184294",
"pm_score": -1,
"selected": false,
"text": "<p>I'd suggest looking at using a custom theme if you want to ignore CSS from your theme and them using... | 2020/03/15 | [
"https://wordpress.stackexchange.com/questions/360745",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184100/"
] | I asked a [previous question](https://wordpress.stackexchange.com/questions/360418/enhancing-gutenberg-featured-image-control), and got a helpful answer that got me going quite a ways. The present problem is unrelated, but IMO reflects the dearth of documentation suitable for those of us who aren't familiar with some o... | You can make sure that your CSS is [enqueued](https://developer.wordpress.org/reference/functions/wp_enqueue_style/) after your theme's CSS and also make sure that your CSS is using rules that are more specific. This will help in making your CSS override the theme's CSS.
Worse-case scenario you could add !important to... |
360,758 | <p>I have a strange issue. I am including dashicons on the front-end through</p>
<pre><code>add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' );
}
</code></pre>
<p>Then I enter dashicon HTML in the Navigation Label of my menu item... | [
{
"answer_id": 360760,
"author": "quantum_leap",
"author_id": 153810,
"author_profile": "https://wordpress.stackexchange.com/users/153810",
"pm_score": -1,
"selected": false,
"text": "<p>I will post the solution that I have found from <a href=\"https://stackoverflow.com/questions/3607826... | 2020/03/15 | [
"https://wordpress.stackexchange.com/questions/360758",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153810/"
] | I have a strange issue. I am including dashicons on the front-end through
```
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' );
}
```
Then I enter dashicon HTML in the Navigation Label of my menu items, for example:
```
<span... | Your problem is that your filter is trimming *all* titles to 7 "words". This includes blog posts, pages, menu item labels, revision names, and even product names, if you have products.
You need to adjust your filter to be less aggressive and only target the titles that you need to truncate. For example, the following ... |
360,785 | <p>After migrating my site to new hosting, it takes longer to load the site. During the migration, I copied only the <em>plugins</em> and <em>uploads</em> folders from the structure, which I pasted into the manually installed Wordpress on the new hosting. I think the site is slower now because of this. </p>
<p>The new... | [
{
"answer_id": 360760,
"author": "quantum_leap",
"author_id": 153810,
"author_profile": "https://wordpress.stackexchange.com/users/153810",
"pm_score": -1,
"selected": false,
"text": "<p>I will post the solution that I have found from <a href=\"https://stackoverflow.com/questions/3607826... | 2020/03/15 | [
"https://wordpress.stackexchange.com/questions/360785",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/150377/"
] | After migrating my site to new hosting, it takes longer to load the site. During the migration, I copied only the *plugins* and *uploads* folders from the structure, which I pasted into the manually installed Wordpress on the new hosting. I think the site is slower now because of this.
The new hosting works on SSD so... | Your problem is that your filter is trimming *all* titles to 7 "words". This includes blog posts, pages, menu item labels, revision names, and even product names, if you have products.
You need to adjust your filter to be less aggressive and only target the titles that you need to truncate. For example, the following ... |
360,842 | <p>I have a custom pos type created in functions.php and working great - except I need to have categories enabled. I have looked through other answers here, and am still not able to figure it out. In my code i have <code>taxonomies => array('categories', 'tags')</code> but it is not working.</p>
<p>Here is my code:... | [
{
"answer_id": 360760,
"author": "quantum_leap",
"author_id": 153810,
"author_profile": "https://wordpress.stackexchange.com/users/153810",
"pm_score": -1,
"selected": false,
"text": "<p>I will post the solution that I have found from <a href=\"https://stackoverflow.com/questions/3607826... | 2020/03/16 | [
"https://wordpress.stackexchange.com/questions/360842",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154852/"
] | I have a custom pos type created in functions.php and working great - except I need to have categories enabled. I have looked through other answers here, and am still not able to figure it out. In my code i have `taxonomies => array('categories', 'tags')` but it is not working.
Here is my code:
```
function custom_po... | Your problem is that your filter is trimming *all* titles to 7 "words". This includes blog posts, pages, menu item labels, revision names, and even product names, if you have products.
You need to adjust your filter to be less aggressive and only target the titles that you need to truncate. For example, the following ... |
360,845 | <p>I've developed a custom theme with a custom post type named <code>events</code>. For some reason, however, WP refuses to use my archive page template with the file name <code>archive-events.php</code> per WP's template hierarchy. WP keeps defaulting to <code>index.php</code> as the template for this post type.</p>
... | [
{
"answer_id": 360760,
"author": "quantum_leap",
"author_id": 153810,
"author_profile": "https://wordpress.stackexchange.com/users/153810",
"pm_score": -1,
"selected": false,
"text": "<p>I will post the solution that I have found from <a href=\"https://stackoverflow.com/questions/3607826... | 2020/03/16 | [
"https://wordpress.stackexchange.com/questions/360845",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184374/"
] | I've developed a custom theme with a custom post type named `events`. For some reason, however, WP refuses to use my archive page template with the file name `archive-events.php` per WP's template hierarchy. WP keeps defaulting to `index.php` as the template for this post type.
Previously I had a page configured in WP... | Your problem is that your filter is trimming *all* titles to 7 "words". This includes blog posts, pages, menu item labels, revision names, and even product names, if you have products.
You need to adjust your filter to be less aggressive and only target the titles that you need to truncate. For example, the following ... |
360,860 | <p><strong>This is common.js</strong></p>
<pre><code>jQuery(function ($) {
var commonJs = {
init: function () {
},
showAlert: function () {
},
}
});
</code></pre>
<p><strong>This is add.js</strong></p>
<pre><code>jQuery(function ($) {
var addJs = {
init: functi... | [
{
"answer_id": 360862,
"author": "Yugma Patel",
"author_id": 184390,
"author_profile": "https://wordpress.stackexchange.com/users/184390",
"pm_score": -1,
"selected": true,
"text": "<p>Please simply place commonJs var outside the jQuery function and try again. It will work for you.</p>\n... | 2020/03/17 | [
"https://wordpress.stackexchange.com/questions/360860",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/150546/"
] | **This is common.js**
```
jQuery(function ($) {
var commonJs = {
init: function () {
},
showAlert: function () {
},
}
});
```
**This is add.js**
```
jQuery(function ($) {
var addJs = {
init: function () {
console.log(commonJs.showAlert);
},... | Please simply place commonJs var outside the jQuery function and try again. It will work for you. |
360,972 | <p>I'm working on a theme that should style all native WordPress blocks via CSS, including potentially extending them with custom 'style' options in the block editor via JS. Does anyone know of a list or reference site which lists all native blocks, ideally including information on the WordPress version(s) where they w... | [
{
"answer_id": 360975,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": false,
"text": "<p>Not at the moment, but, you can go to a page with the block editor, open the browser dev tools, go to the co... | 2020/03/18 | [
"https://wordpress.stackexchange.com/questions/360972",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16/"
] | I'm working on a theme that should style all native WordPress blocks via CSS, including potentially extending them with custom 'style' options in the block editor via JS. Does anyone know of a list or reference site which lists all native blocks, ideally including information on the WordPress version(s) where they were... | Not at the moment, but, you can go to a page with the block editor, open the browser dev tools, go to the console, and run the following:
```js
// grab all block types
const types = wp.blocks.getBlockTypes();
// filter to just the core blocks
const core_blocks = types.filter(
type => type.name.startsWith( 'core/'... |
360,987 | <p>I know how to put only 5 posts per page with pagination. But let say I have 4000 posts but I don’t want to let people to be able to see all my posts. I just want to display 20 posts in 4 pages (5 per pages). </p>
<pre><code>$args = array(
'post_type' => 'blog_posts',
'posts_per_page' => '5',
);
$quer... | [
{
"answer_id": 360993,
"author": "Mikhail",
"author_id": 88888,
"author_profile": "https://wordpress.stackexchange.com/users/88888",
"pm_score": 2,
"selected": true,
"text": "<p>I consider the right way could be filtering of total number of found posts like this.</p>\n\n<pre><code>functi... | 2020/03/18 | [
"https://wordpress.stackexchange.com/questions/360987",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/57405/"
] | I know how to put only 5 posts per page with pagination. But let say I have 4000 posts but I don’t want to let people to be able to see all my posts. I just want to display 20 posts in 4 pages (5 per pages).
```
$args = array(
'post_type' => 'blog_posts',
'posts_per_page' => '5',
);
$query = new WP_Query($ar... | I consider the right way could be filtering of total number of found posts like this.
```
function my_custom_found_posts_limiter( $found_posts, $wp_query ) {
$maximum_of_post_items = 100; // place your desired value here or read if from option\setting.
if ( ! is_admin() && $wp_query->is_main_query() && $wp_q... |
361,052 | <p>I am looking to make a few different displays on the home page of terms within certain taxonomies as well as their image field as defined by ACF.</p>
<p>I have been looking online and found 2 main different ways to do this and would like to initially ask what is the difference between the two:?</p>
<pre><code>WP_T... | [
{
"answer_id": 360993,
"author": "Mikhail",
"author_id": 88888,
"author_profile": "https://wordpress.stackexchange.com/users/88888",
"pm_score": 2,
"selected": true,
"text": "<p>I consider the right way could be filtering of total number of found posts like this.</p>\n\n<pre><code>functi... | 2020/03/19 | [
"https://wordpress.stackexchange.com/questions/361052",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/68090/"
] | I am looking to make a few different displays on the home page of terms within certain taxonomies as well as their image field as defined by ACF.
I have been looking online and found 2 main different ways to do this and would like to initially ask what is the difference between the two:?
```
WP_Term_Query();
```
an... | I consider the right way could be filtering of total number of found posts like this.
```
function my_custom_found_posts_limiter( $found_posts, $wp_query ) {
$maximum_of_post_items = 100; // place your desired value here or read if from option\setting.
if ( ! is_admin() && $wp_query->is_main_query() && $wp_q... |
361,138 | <p>I got the sku to to show in the cart for each item - Does anyone have the correct php code to get the sku under each product name on all pages?</p>
| [
{
"answer_id": 360993,
"author": "Mikhail",
"author_id": 88888,
"author_profile": "https://wordpress.stackexchange.com/users/88888",
"pm_score": 2,
"selected": true,
"text": "<p>I consider the right way could be filtering of total number of found posts like this.</p>\n\n<pre><code>functi... | 2020/03/21 | [
"https://wordpress.stackexchange.com/questions/361138",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184591/"
] | I got the sku to to show in the cart for each item - Does anyone have the correct php code to get the sku under each product name on all pages? | I consider the right way could be filtering of total number of found posts like this.
```
function my_custom_found_posts_limiter( $found_posts, $wp_query ) {
$maximum_of_post_items = 100; // place your desired value here or read if from option\setting.
if ( ! is_admin() && $wp_query->is_main_query() && $wp_q... |
361,146 | <p>I'm trying to install Wordpress 5.3.2 on NetBSD (unix). phpinfo() tells me I am running Apache/2.4.33 (Unix) PHP/7.2.6</p>
<p>/wp-admin/setup-config.php?step=1 has a message at the bottom of the window (below the "submit" button) saying "There has been a critical error on your website". </p>
<p>Thinking to set WP_... | [
{
"answer_id": 360993,
"author": "Mikhail",
"author_id": 88888,
"author_profile": "https://wordpress.stackexchange.com/users/88888",
"pm_score": 2,
"selected": true,
"text": "<p>I consider the right way could be filtering of total number of found posts like this.</p>\n\n<pre><code>functi... | 2020/03/21 | [
"https://wordpress.stackexchange.com/questions/361146",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184599/"
] | I'm trying to install Wordpress 5.3.2 on NetBSD (unix). phpinfo() tells me I am running Apache/2.4.33 (Unix) PHP/7.2.6
/wp-admin/setup-config.php?step=1 has a message at the bottom of the window (below the "submit" button) saying "There has been a critical error on your website".
Thinking to set WP\_DEBUG to "true" ... | I consider the right way could be filtering of total number of found posts like this.
```
function my_custom_found_posts_limiter( $found_posts, $wp_query ) {
$maximum_of_post_items = 100; // place your desired value here or read if from option\setting.
if ( ! is_admin() && $wp_query->is_main_query() && $wp_q... |
361,203 | <p>I want the permalinks to be like youtube generated from letters and numbers in 9 digits I modified this code</p>
<pre><code>add_filter( 'wp_unique_post_slug', 'unique_slug_108286', 10, 4 );
function unique_slug_108286( $slug) {
$n=4;
$slug = bin2hex(random_bytes($n)); //just an example
return $slug;
}... | [
{
"answer_id": 361209,
"author": "Shazzad",
"author_id": 42967,
"author_profile": "https://wordpress.stackexchange.com/users/42967",
"pm_score": 1,
"selected": false,
"text": "<p>The second argument of <code>wp_unique_post_slug</code> filter is post id. You can utilize that to generate t... | 2020/03/22 | [
"https://wordpress.stackexchange.com/questions/361203",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184638/"
] | I want the permalinks to be like youtube generated from letters and numbers in 9 digits I modified this code
```
add_filter( 'wp_unique_post_slug', 'unique_slug_108286', 10, 4 );
function unique_slug_108286( $slug) {
$n=4;
$slug = bin2hex(random_bytes($n)); //just an example
return $slug;
}
```
so it's... | The second argument of `wp_unique_post_slug` filter is post id. You can utilize that to generate the slug only once while creating the post for the first time.
**Method 1:**
```
add_filter( 'wp_unique_post_slug', 'unique_slug_108286', 10, 2 );
function unique_slug_108286( $slug, $postId ) {
if ( ! $postId ) {
... |
361,204 | <p>I am working on a project that needs a website with region specific pages. One of the key requirements is that while the blog, about and other pages are the same for all regions pricing, staff, booking and events pages would be specific to the region. </p>
<p>Think something like this: <a href="https://locations.ma... | [
{
"answer_id": 361209,
"author": "Shazzad",
"author_id": 42967,
"author_profile": "https://wordpress.stackexchange.com/users/42967",
"pm_score": 1,
"selected": false,
"text": "<p>The second argument of <code>wp_unique_post_slug</code> filter is post id. You can utilize that to generate t... | 2020/03/22 | [
"https://wordpress.stackexchange.com/questions/361204",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184644/"
] | I am working on a project that needs a website with region specific pages. One of the key requirements is that while the blog, about and other pages are the same for all regions pricing, staff, booking and events pages would be specific to the region.
Think something like this: <https://locations.massageenvy.com/utah... | The second argument of `wp_unique_post_slug` filter is post id. You can utilize that to generate the slug only once while creating the post for the first time.
**Method 1:**
```
add_filter( 'wp_unique_post_slug', 'unique_slug_108286', 10, 2 );
function unique_slug_108286( $slug, $postId ) {
if ( ! $postId ) {
... |
361,205 | <p>I have a website that sells gaming related stuff, i need to show some buffs as icons/small images under every product below the product image, on the archive/category page, apparently there is no such option nor plugin on the internet that can help me (i would like to be corrected on this please)</p>
<p>So i am try... | [
{
"answer_id": 361246,
"author": "7uc1f3r",
"author_id": 182113,
"author_profile": "https://wordpress.stackexchange.com/users/182113",
"pm_score": 0,
"selected": false,
"text": "<p>I don't use the plugin you use for adding images. You can run the following code, this will give you more i... | 2020/03/22 | [
"https://wordpress.stackexchange.com/questions/361205",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/166733/"
] | I have a website that sells gaming related stuff, i need to show some buffs as icons/small images under every product below the product image, on the archive/category page, apparently there is no such option nor plugin on the internet that can help me (i would like to be corrected on this please)
So i am trying to wor... | So I was not able to solve my problem earlier, then I switched the plugin to "[Category and Taxonomy Image](https://wordpress.org/plugins/wp-custom-taxonomy-image/)" (by Aftab Hussain) and used the following code to display the icons on category/archive pages:
```php
add_action( 'woocommerce_after_shop_loop_item', 'at... |
361,265 | <p>I want to compare two prices in my database. I get a row with any id:</p>
<pre><code>$price1 = $wpdb->get_row( "SELECT * FROM $wpdb->prices WHERE id = 10" );
</code></pre>
<p>I want to get up the row from this table means I want to get row same bellow but if row by id 9 is deleted it's missing:</p>
<pre><co... | [
{
"answer_id": 361246,
"author": "7uc1f3r",
"author_id": 182113,
"author_profile": "https://wordpress.stackexchange.com/users/182113",
"pm_score": 0,
"selected": false,
"text": "<p>I don't use the plugin you use for adding images. You can run the following code, this will give you more i... | 2020/03/23 | [
"https://wordpress.stackexchange.com/questions/361265",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175073/"
] | I want to compare two prices in my database. I get a row with any id:
```
$price1 = $wpdb->get_row( "SELECT * FROM $wpdb->prices WHERE id = 10" );
```
I want to get up the row from this table means I want to get row same bellow but if row by id 9 is deleted it's missing:
```
$price1 = $wpdb->get_row( "SELECT * FROM... | So I was not able to solve my problem earlier, then I switched the plugin to "[Category and Taxonomy Image](https://wordpress.org/plugins/wp-custom-taxonomy-image/)" (by Aftab Hussain) and used the following code to display the icons on category/archive pages:
```php
add_action( 'woocommerce_after_shop_loop_item', 'at... |
361,330 | <p>I have a custom plugin and want it on occasions to fire the kind of notice that appears and disapears in the left corner like this one:</p>
<p><a href="https://i.stack.imgur.com/vvFwm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vvFwm.png" alt="snackbar notice"></a></p>
<p>I found some code <... | [
{
"answer_id": 376902,
"author": "Andre Gagnon",
"author_id": 196421,
"author_profile": "https://wordpress.stackexchange.com/users/196421",
"pm_score": 4,
"selected": true,
"text": "<p>WordPress has some global actions you can use here. If you want to add your own notice in the lower cor... | 2020/03/24 | [
"https://wordpress.stackexchange.com/questions/361330",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/89973/"
] | I have a custom plugin and want it on occasions to fire the kind of notice that appears and disapears in the left corner like this one:
[](https://i.stack.imgur.com/vvFwm.png)
I found some code [in the Gutenberg docs here](https://developer.wordpress.org/block-ed... | WordPress has some global actions you can use here. If you want to add your own notice in the lower corner (like the screenshot), you can do that like this:
```js
wp.data.dispatch("core/notices").createNotice(
"success", // Can be one of: success, info, warning, error.
"This is my custom message.", //... |
361,364 | <p>I'd like to have the checkout billing form on two columns. Is there a way to wrap half of the fields in a div and the other hald in another so that it's easy to use a <code>float</code> or <code>flexbox</code>?</p>
<p>The form is invoked in <code>form-billing.php</code> via <code>woocommerce_form_field</code> in a ... | [
{
"answer_id": 361490,
"author": "7uc1f3r",
"author_id": 182113,
"author_profile": "https://wordpress.stackexchange.com/users/182113",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>woocommerce_form_field in the foreach loop</p>\n \n <p><a href=\"https://github.com/wooco... | 2020/03/24 | [
"https://wordpress.stackexchange.com/questions/361364",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/77030/"
] | I'd like to have the checkout billing form on two columns. Is there a way to wrap half of the fields in a div and the other hald in another so that it's easy to use a `float` or `flexbox`?
The form is invoked in `form-billing.php` via `woocommerce_form_field` in a `forEach` loop, but I'm clueless as to where I could f... | My question was wrong because I had forgotten some things I had tried earlier. Splitting the form field within two divs is easy task:
```
// form-billing.php
<div class="woocommerce-billing-fields__field-wrapper">
<?php
$fields = $checkout->get_checkout_fields('billing');
$fields_half_count = round... |
361,369 | <p>I want to change the default template for my pages to a template called <code>fullwidthpage.php</code>.</p>
<p>I have seen <a href="https://wordpress.stackexchange.com/q/196289/172169">this question posted and answered</a> for pre-Gutenberg Wordpress, but I have not found a working answer for Gutenberg Wordpress (v... | [
{
"answer_id": 361412,
"author": "J. A.",
"author_id": 163393,
"author_profile": "https://wordpress.stackexchange.com/users/163393",
"pm_score": 0,
"selected": false,
"text": "<p>On the right hand side of your editor, at the top there are two tabs: Document and Block, click on document a... | 2020/03/24 | [
"https://wordpress.stackexchange.com/questions/361369",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/172169/"
] | I want to change the default template for my pages to a template called `fullwidthpage.php`.
I have seen [this question posted and answered](https://wordpress.stackexchange.com/q/196289/172169) for pre-Gutenberg Wordpress, but I have not found a working answer for Gutenberg Wordpress (version 5.3.2 at the time of this... | I was looking for the same thing.
[This Answer](https://wordpress.stackexchange.com/a/346866/207344) by SkyShab did the trick. Posted below for convenience.
```
wp.data.dispatch('core/editor').editPost( {template: "template-name.php"} )
``` |
361,514 | <p>I am using Azure Cloud, multisite WordPress and have enabled these codes in wp-config.php file.</p>
<pre><code> // Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEB... | [
{
"answer_id": 361516,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 1,
"selected": false,
"text": "<p>Take out the <code>@ini_set</code>. I'm not sure what your intent is there, but you're doing two differen... | 2020/03/26 | [
"https://wordpress.stackexchange.com/questions/361514",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184876/"
] | I am using Azure Cloud, multisite WordPress and have enabled these codes in wp-config.php file.
```
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', t... | Take out the `@ini_set`. I'm not sure what your intent is there, but you're doing two different things. Your setting for `WP_DEBUG_DISPLAY` is telling it to display errors (set to `true`), and then you're turning around and telling it not to (`ini_set` to 0).
The value of `WP_DEBUG_DISPLAY` is used to determine whethe... |
361,559 | <p>I created a simple form for my users to can change their passwords. but there is a problem and I am confused! I tried a lot to change my password but my pass will not be changed by <code>wp_set_password()</code> and I do not know the reason really. </p>
<pre><code><?php /* Template Name: user-edit-password */ ?... | [
{
"answer_id": 361516,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 1,
"selected": false,
"text": "<p>Take out the <code>@ini_set</code>. I'm not sure what your intent is there, but you're doing two differen... | 2020/03/26 | [
"https://wordpress.stackexchange.com/questions/361559",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157522/"
] | I created a simple form for my users to can change their passwords. but there is a problem and I am confused! I tried a lot to change my password but my pass will not be changed by `wp_set_password()` and I do not know the reason really.
```
<?php /* Template Name: user-edit-password */ ?>
<?php
$user = wp_get_curre... | Take out the `@ini_set`. I'm not sure what your intent is there, but you're doing two different things. Your setting for `WP_DEBUG_DISPLAY` is telling it to display errors (set to `true`), and then you're turning around and telling it not to (`ini_set` to 0).
The value of `WP_DEBUG_DISPLAY` is used to determine whethe... |
361,576 | <h1>Background</h1>
<p>I'm developing a <a href="https://github.com/badAd/wordpress" rel="nofollow noreferrer">plugin for WordPress</a>. I initially used <code>file_get_contents()</code> for two purposes:</p>
<ol>
<li>A remote file (which I changed to <code>wp_remote_post()</code>)</li>
<li>A local file in the plugin d... | [
{
"answer_id": 362729,
"author": "Jesse",
"author_id": 152716,
"author_profile": "https://wordpress.stackexchange.com/users/152716",
"pm_score": 0,
"selected": false,
"text": "<h1><code>$wp_filesystem->get_contents()</code></h1>\n\n<p><code>$wp_filesystem->get_contents()</code> rep... | 2020/03/27 | [
"https://wordpress.stackexchange.com/questions/361576",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/152716/"
] | Background
==========
I'm developing a [plugin for WordPress](https://github.com/badAd/wordpress). I initially used `file_get_contents()` for two purposes:
1. A remote file (which I changed to `wp_remote_post()`)
2. A local file in the plugin dir (what this question is about)
WordPress staff told me to NOT use `file... | The alternate of using `file_get_contents()` is to initiate `WP_Filesystem` and use its `$wp_filesystem->get_contents` method.
Here is a clean example method on how to use it
**Example**
```
<?php
/**
* This method gets a list of the most popular Google web fonts.
* Initialize the WP filesystem and n... |
361,581 | <p>I want to add <strong>Like & Dislike</strong> functionality into my custom post type, called <code>game</code>.</p>
<p>I have placed like and dislike icon links in my post footer.</p>
<p><strong>Desired Behaviour:</strong></p>
<p>When a user clicks the like icon, I want to check if (s)he already voted for it ... | [
{
"answer_id": 361589,
"author": "Christmas",
"author_id": 184919,
"author_profile": "https://wordpress.stackexchange.com/users/184919",
"pm_score": 1,
"selected": false,
"text": "<p>I don't understand how u can count like in javascript only.\nUse wp_ajax_ACTION Hook to call your PHP fun... | 2020/03/27 | [
"https://wordpress.stackexchange.com/questions/361581",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/123788/"
] | I want to add **Like & Dislike** functionality into my custom post type, called `game`.
I have placed like and dislike icon links in my post footer.
**Desired Behaviour:**
When a user clicks the like icon, I want to check if (s)he already voted for it and if not then create or update post like count meta key inside ... | I hope you are doing well. Here, I am sharing code for recording likes. The code for `single.php` have the javascript code for making an ajax call to a wp function. This wp function have the code to store like expressions and it will return you the total number of like expressions recorded on post.
I have curated it f... |
362,699 | <p>I have a custom taxonomy called "Sources" (using Custom Post Type UI), where the sources are the names of publications where articles were originally published. Each post is an article, with a source selected. What I need to do is to show the source in the metadata under the post title. I'm using the Avada theme. Cu... | [
{
"answer_id": 361589,
"author": "Christmas",
"author_id": 184919,
"author_profile": "https://wordpress.stackexchange.com/users/184919",
"pm_score": 1,
"selected": false,
"text": "<p>I don't understand how u can count like in javascript only.\nUse wp_ajax_ACTION Hook to call your PHP fun... | 2020/03/29 | [
"https://wordpress.stackexchange.com/questions/362699",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/73388/"
] | I have a custom taxonomy called "Sources" (using Custom Post Type UI), where the sources are the names of publications where articles were originally published. Each post is an article, with a source selected. What I need to do is to show the source in the metadata under the post title. I'm using the Avada theme. Curre... | I hope you are doing well. Here, I am sharing code for recording likes. The code for `single.php` have the javascript code for making an ajax call to a wp function. This wp function have the code to store like expressions and it will return you the total number of like expressions recorded on post.
I have curated it f... |
362,708 | <p>I had a website which it’s domain is expired: <a href="https://mrafiee.net" rel="nofollow noreferrer">https://mrafiee.net</a>
I also have another active domain and website: <a href="https://rafiee.net" rel="nofollow noreferrer">https://rafiee.net</a></p>
<p>I have created a subdomain under my active domain: <a href... | [
{
"answer_id": 361589,
"author": "Christmas",
"author_id": 184919,
"author_profile": "https://wordpress.stackexchange.com/users/184919",
"pm_score": 1,
"selected": false,
"text": "<p>I don't understand how u can count like in javascript only.\nUse wp_ajax_ACTION Hook to call your PHP fun... | 2020/03/29 | [
"https://wordpress.stackexchange.com/questions/362708",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/171493/"
] | I had a website which it’s domain is expired: <https://mrafiee.net>
I also have another active domain and website: <https://rafiee.net>
I have created a subdomain under my active domain: <https://old.rafiee.net>
I copied all content in mrafiee.net foolder (which is an add-on domain in my cpanel) in my host, to old.raf... | I hope you are doing well. Here, I am sharing code for recording likes. The code for `single.php` have the javascript code for making an ajax call to a wp function. This wp function have the code to store like expressions and it will return you the total number of like expressions recorded on post.
I have curated it f... |
362,795 | <p>I using the below code to get modified data for the post, but I need to get the same modified post for my other custom posts. For example, it works if i change post to test( my custom post type name)"if( 'post' === get_post_type() )", but i need for both test, post and movies etc.</p>
<pre><code>function et_last_mo... | [
{
"answer_id": 362797,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 3,
"selected": true,
"text": "<p>In your if statement just add more conditions like this.</p>\n\n<pre><code>function et_last_modified_date... | 2020/03/30 | [
"https://wordpress.stackexchange.com/questions/362795",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185081/"
] | I using the below code to get modified data for the post, but I need to get the same modified post for my other custom posts. For example, it works if i change post to test( my custom post type name)"if( 'post' === get\_post\_type() )", but i need for both test, post and movies etc.
```
function et_last_modified_date_... | In your if statement just add more conditions like this.
```
function et_last_modified_date_blog( $the_date ) {
if ( 'post' === get_post_type() || 'movies' === get_post_type() || 'etc' === get_post_type()) {
$the_time = get_post_time( 'His' );
$the_modified = get_post_modified_time( 'His' );
... |
362,834 | <p>At the bottom of a post, I show all that tags that post has. </p>
<p>If the current post is the only post with tag X, then I don't want tag X to show in the list. Because if someone clicks on that, they'll be taken to an archive page where the post they were just looking at is the only post listed. Useless.</p>
<p... | [
{
"answer_id": 362840,
"author": "西門 正 Code Guy",
"author_id": 35701,
"author_profile": "https://wordpress.stackexchange.com/users/35701",
"pm_score": 2,
"selected": true,
"text": "<p>Because <a href=\"https://developer.wordpress.org/reference/functions/get_the_term_list/\" rel=\"nofollo... | 2020/03/31 | [
"https://wordpress.stackexchange.com/questions/362834",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184735/"
] | At the bottom of a post, I show all that tags that post has.
If the current post is the only post with tag X, then I don't want tag X to show in the list. Because if someone clicks on that, they'll be taken to an archive page where the post they were just looking at is the only post listed. Useless.
Otherwise I don'... | Because [get\_the\_term\_list()](https://developer.wordpress.org/reference/functions/get_the_term_list/) create the html link for you.
So
1. you need to use [wp\_get\_object\_terms](https://developer.wordpress.org/reference/functions/wp_get_object_terms/) to get a list of terms info first with count for handling.
2. ... |
362,853 | <p>My Website, How to Stop Spamming in <a href="https://www.findtricks.in/thop-tv-mod-apk/" rel="nofollow noreferrer">WordPress</a>, Plz Help Me.</p>
| [
{
"answer_id": 362840,
"author": "西門 正 Code Guy",
"author_id": 35701,
"author_profile": "https://wordpress.stackexchange.com/users/35701",
"pm_score": 2,
"selected": true,
"text": "<p>Because <a href=\"https://developer.wordpress.org/reference/functions/get_the_term_list/\" rel=\"nofollo... | 2020/03/31 | [
"https://wordpress.stackexchange.com/questions/362853",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185128/"
] | My Website, How to Stop Spamming in [WordPress](https://www.findtricks.in/thop-tv-mod-apk/), Plz Help Me. | Because [get\_the\_term\_list()](https://developer.wordpress.org/reference/functions/get_the_term_list/) create the html link for you.
So
1. you need to use [wp\_get\_object\_terms](https://developer.wordpress.org/reference/functions/wp_get_object_terms/) to get a list of terms info first with count for handling.
2. ... |
362,855 | <p>I created like system in wordpress. And I created 'sayim_beyenme' table and created 'say_post_id' and 'total_post_likes' datas. Now I want to display my posts orderby total likes per each post. I get posts ids with array_map, but I dont know how can I order these posts by total_post_like values. For testing I have u... | [
{
"answer_id": 362840,
"author": "西門 正 Code Guy",
"author_id": 35701,
"author_profile": "https://wordpress.stackexchange.com/users/35701",
"pm_score": 2,
"selected": true,
"text": "<p>Because <a href=\"https://developer.wordpress.org/reference/functions/get_the_term_list/\" rel=\"nofollo... | 2020/03/31 | [
"https://wordpress.stackexchange.com/questions/362855",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/125615/"
] | I created like system in wordpress. And I created 'sayim\_beyenme' table and created 'say\_post\_id' and 'total\_post\_likes' datas. Now I want to display my posts orderby total likes per each post. I get posts ids with array\_map, but I dont know how can I order these posts by total\_post\_like values. For testing I h... | Because [get\_the\_term\_list()](https://developer.wordpress.org/reference/functions/get_the_term_list/) create the html link for you.
So
1. you need to use [wp\_get\_object\_terms](https://developer.wordpress.org/reference/functions/wp_get_object_terms/) to get a list of terms info first with count for handling.
2. ... |
362,882 | <p>I'm trying to accomplish this simple task through different plugins, but I can't find the right one for different reasons.</p>
<p>I have a Login Page with a login form. When user logs in, he's redirected to a specific page (based on user role). If the user visits again the Login Page, the login form displays a Welc... | [
{
"answer_id": 362840,
"author": "西門 正 Code Guy",
"author_id": 35701,
"author_profile": "https://wordpress.stackexchange.com/users/35701",
"pm_score": 2,
"selected": true,
"text": "<p>Because <a href=\"https://developer.wordpress.org/reference/functions/get_the_term_list/\" rel=\"nofollo... | 2020/03/31 | [
"https://wordpress.stackexchange.com/questions/362882",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/89820/"
] | I'm trying to accomplish this simple task through different plugins, but I can't find the right one for different reasons.
I have a Login Page with a login form. When user logs in, he's redirected to a specific page (based on user role). If the user visits again the Login Page, the login form displays a Welcome messag... | Because [get\_the\_term\_list()](https://developer.wordpress.org/reference/functions/get_the_term_list/) create the html link for you.
So
1. you need to use [wp\_get\_object\_terms](https://developer.wordpress.org/reference/functions/wp_get_object_terms/) to get a list of terms info first with count for handling.
2. ... |
362,888 | <p>This must be a very amateurish question but... </p>
<p>I'm using page templates from the dropdown menu in page editor but I can't find their source code. I know that usually this can be found in themes/"theme name"/page-templates, but no matter how hard I look, I just can't find the files for several of the templat... | [
{
"answer_id": 362897,
"author": "Eshban",
"author_id": 162989,
"author_profile": "https://wordpress.stackexchange.com/users/162989",
"pm_score": 0,
"selected": false,
"text": "<p>I suggest you to download the starter theme from <a href=\"https://underscores.me/\" rel=\"nofollow noreferr... | 2020/03/31 | [
"https://wordpress.stackexchange.com/questions/362888",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/183438/"
] | This must be a very amateurish question but...
I'm using page templates from the dropdown menu in page editor but I can't find their source code. I know that usually this can be found in themes/"theme name"/page-templates, but no matter how hard I look, I just can't find the files for several of the templates I'm usi... | You can simply right click on your Template Select on the edit page, Inspect Element (on Chrome) then you can check the different options in the select like "page-template.php" as value and find your template file. :)
```
<select id="inspector-select-control-0" class="components-select-control__input">
<option val... |
362,901 | <pre><code>//Get Services and save to database first.
for($i = 0; $i < count($_POST["wc_service_id"]); $i++) {
$wc_service_id = $_POST["wc_service_id"][$i];
$wc_service_name = $_POST["wc_service_name"][$i];
$wc_service_code = $_POST["wc_service_code"][$i];
$wc_service_qty ... | [
{
"answer_id": 362915,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 3,
"selected": true,
"text": "<p><em>You don't need to remove the <code>prepare()</code>, but you just need to do it properly.</em></p>\n\n<... | 2020/03/31 | [
"https://wordpress.stackexchange.com/questions/362901",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/170243/"
] | ```
//Get Services and save to database first.
for($i = 0; $i < count($_POST["wc_service_id"]); $i++) {
$wc_service_id = $_POST["wc_service_id"][$i];
$wc_service_name = $_POST["wc_service_name"][$i];
$wc_service_code = $_POST["wc_service_code"][$i];
$wc_service_qty = $_PO... | *You don't need to remove the `prepare()`, but you just need to do it properly.*
And please check the `$wpdb->prepare()` [reference](https://developer.wordpress.org/reference/classes/wpdb/prepare/) for the function's syntax etc., but basically, instead of (wrapped for brevity):
```php
$insert_query = "INSERT INTO `".... |
362,907 | <p>It is my first form trying on wordpress.I changed some names such as "name","e-mail" etc. to "name1" , "email1" etc.Because without these changing, submit button refers to 404 page.</p>
<p>There is no any registration on database when I check it</p>
<blockquote>
<p>I dont know any idea about what is the spesific... | [
{
"answer_id": 362915,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 3,
"selected": true,
"text": "<p><em>You don't need to remove the <code>prepare()</code>, but you just need to do it properly.</em></p>\n\n<... | 2020/03/31 | [
"https://wordpress.stackexchange.com/questions/362907",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180385/"
] | It is my first form trying on wordpress.I changed some names such as "name","e-mail" etc. to "name1" , "email1" etc.Because without these changing, submit button refers to 404 page.
There is no any registration on database when I check it
>
> I dont know any idea about what is the spesific code as problem so I
> gi... | *You don't need to remove the `prepare()`, but you just need to do it properly.*
And please check the `$wpdb->prepare()` [reference](https://developer.wordpress.org/reference/classes/wpdb/prepare/) for the function's syntax etc., but basically, instead of (wrapped for brevity):
```php
$insert_query = "INSERT INTO `".... |
362,987 | <p>I am creating in personal plugin where I recover data from a personal table.
Con add_action('the_content', 'my_plugin_content'); posso far vedere il contenuto in una pagina.
I would like to save the content in wp_posts with add_filter ('save_post', 'my_plugin_content'), but the content is empty.</p>
<pre><code>func... | [
{
"answer_id": 362915,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 3,
"selected": true,
"text": "<p><em>You don't need to remove the <code>prepare()</code>, but you just need to do it properly.</em></p>\n\n<... | 2020/04/01 | [
"https://wordpress.stackexchange.com/questions/362987",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185239/"
] | I am creating in personal plugin where I recover data from a personal table.
Con add\_action('the\_content', 'my\_plugin\_content'); posso far vedere il contenuto in una pagina.
I would like to save the content in wp\_posts with add\_filter ('save\_post', 'my\_plugin\_content'), but the content is empty.
```
function ... | *You don't need to remove the `prepare()`, but you just need to do it properly.*
And please check the `$wpdb->prepare()` [reference](https://developer.wordpress.org/reference/classes/wpdb/prepare/) for the function's syntax etc., but basically, instead of (wrapped for brevity):
```php
$insert_query = "INSERT INTO `".... |
363,018 | <p>In the saga so far, you can see my</p>
<ol>
<li><a href="https://wordpress.stackexchange.com/questions/360418/enhancing-gutenberg-featured-image-control">First post/question</a></li>
<li><a href="https://wordpress.stackexchange.com/questions/360745/using-gutenberg-block-components-in-admin-interface-controls">Secon... | [
{
"answer_id": 363047,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 2,
"selected": false,
"text": "<h3>Your JavaScript code works for me. The metadata do get saved.</h3>\n\n<p>But perhaps you'd like to try <a... | 2020/04/02 | [
"https://wordpress.stackexchange.com/questions/363018",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184100/"
] | In the saga so far, you can see my
1. [First post/question](https://wordpress.stackexchange.com/questions/360418/enhancing-gutenberg-featured-image-control)
2. [Second post/question](https://wordpress.stackexchange.com/questions/360745/using-gutenberg-block-components-in-admin-interface-controls)
This is my third (an... | So I figured it out. @Sally is correct that the basic code I wrote works. However, there's one small caveat that is worth mentioning here and I'll also document a method of testing database connectivity from any post edit page **without any UI code**.
Firstly, no javascript is required for wordpress to recognize the p... |
363,042 | <p>WordPress 5.4 introduced the <em>Site Health Status</em> dashboard widget (<a href="https://github.com/WordPress/WordPress/commit/2c4480958bc230cbe89978738a26156c5346e785" rel="nofollow noreferrer">source</a>). </p>
<p>The dashboard widget shows the status of the <a href="https://make.wordpress.org/core/2019/04/25/... | [
{
"answer_id": 363043,
"author": "Sven",
"author_id": 32946,
"author_profile": "https://wordpress.stackexchange.com/users/32946",
"pm_score": 4,
"selected": true,
"text": "<p>The following snippet removes the <a href=\"https://github.com/WordPress/WordPress/blob/5.4-branch/wp-admin/inclu... | 2020/04/02 | [
"https://wordpress.stackexchange.com/questions/363042",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/32946/"
] | WordPress 5.4 introduced the *Site Health Status* dashboard widget ([source](https://github.com/WordPress/WordPress/commit/2c4480958bc230cbe89978738a26156c5346e785)).
The dashboard widget shows the status of the [site health check](https://make.wordpress.org/core/2019/04/25/site-health-check-in-5-2/):
[ from the dashboard. Add the code to your plugin or `functions.php` file:
```
add_action('wp_dashboard_setup', 'remove_site_health_dashboard_widget');
f... |
363,059 | <p>My search-results are not displayed. Instead searches show a 404. See <a href="https://startupsagainstcorona.com/solutions/" rel="nofollow noreferrer">https://startupsagainstcorona.com/solutions/</a> for testing. Can someone help?</p>
<p>What did I do?</p>
<ol>
<li>I implemented the standard WP-search using get_se... | [
{
"answer_id": 363043,
"author": "Sven",
"author_id": 32946,
"author_profile": "https://wordpress.stackexchange.com/users/32946",
"pm_score": 4,
"selected": true,
"text": "<p>The following snippet removes the <a href=\"https://github.com/WordPress/WordPress/blob/5.4-branch/wp-admin/inclu... | 2020/04/02 | [
"https://wordpress.stackexchange.com/questions/363059",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185295/"
] | My search-results are not displayed. Instead searches show a 404. See <https://startupsagainstcorona.com/solutions/> for testing. Can someone help?
What did I do?
1. I implemented the standard WP-search using get\_search\_form(). This
worked fine, as you can see on the page.
2. I added the search.php and searchform.p... | The following snippet removes the [registered site health dashboard widget](https://github.com/WordPress/WordPress/blob/5.4-branch/wp-admin/includes/dashboard.php#L56) from the dashboard. Add the code to your plugin or `functions.php` file:
```
add_action('wp_dashboard_setup', 'remove_site_health_dashboard_widget');
f... |
363,064 | <p>I was thinking this might be done by adding custom CSS to a page template. I have a page template like this: </p>
<pre><code><?php
/*
* Template Name: Grafy Full Width
*/
/*add_filter('materialis_full_width_page', '__return_true');*/
materialis_get_header();
?>
<div <?php echo materialis_page_co... | [
{
"answer_id": 363066,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<p>If you used the <code>body_class</code> and <code>post_class</code> template tags, you get a CSS class added ... | 2020/04/02 | [
"https://wordpress.stackexchange.com/questions/363064",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/183438/"
] | I was thinking this might be done by adding custom CSS to a page template. I have a page template like this:
```
<?php
/*
* Template Name: Grafy Full Width
*/
/*add_filter('materialis_full_width_page', '__return_true');*/
materialis_get_header();
?>
<div <?php echo materialis_page_content_atts(); ?>>
... | If you used the `body_class` and `post_class` template tags, you get a CSS class added that contains classes for all the tags and terms a post has which you can use to conditionally style posts without needing to conditionally enqueue stylesheets |
363,095 | <p>Hopefully, I can explain this well enough, but let me know if not and I'll expand on it.</p>
<p>I've used ACF in conjunction with a Custom Post Type, but when I try to grab the photo that I've uploaded for each product it only shows the photo for the first product each time for all products on the archive-products.... | [
{
"answer_id": 363096,
"author": "rudtek",
"author_id": 77767,
"author_profile": "https://wordpress.stackexchange.com/users/77767",
"pm_score": 3,
"selected": true,
"text": "<p>You need to define <code>$landscape</code> in the loop. You're defining out so it is not part of your repeatin... | 2020/04/02 | [
"https://wordpress.stackexchange.com/questions/363095",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160534/"
] | Hopefully, I can explain this well enough, but let me know if not and I'll expand on it.
I've used ACF in conjunction with a Custom Post Type, but when I try to grab the photo that I've uploaded for each product it only shows the photo for the first product each time for all products on the archive-products.php page.
... | You need to define `$landscape` in the loop. You're defining out so it is not part of your repeating portion.
Move it down just under the `while` line so it looks like this:
```
<?php
$args = array( 'post_type' => 'products', 'posts_per_page' => 9 );
$the_query = new WP_Query( $args );
?>
<main class="site-content... |
363,106 | <p>I am using Stripe Connect to collect a commission for sales on a woocommerce site. </p>
<p>I need to add the following to the payment request JSON. </p>
<pre><code> 'application_fee_amount' => (Gateway Based Fees Amount),
'transfer_data' => [
'destination' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
],... | [
{
"answer_id": 363096,
"author": "rudtek",
"author_id": 77767,
"author_profile": "https://wordpress.stackexchange.com/users/77767",
"pm_score": 3,
"selected": true,
"text": "<p>You need to define <code>$landscape</code> in the loop. You're defining out so it is not part of your repeatin... | 2020/04/03 | [
"https://wordpress.stackexchange.com/questions/363106",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70863/"
] | I am using Stripe Connect to collect a commission for sales on a woocommerce site.
I need to add the following to the payment request JSON.
```
'application_fee_amount' => (Gateway Based Fees Amount),
'transfer_data' => [
'destination' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
],
```
This code I found and m... | You need to define `$landscape` in the loop. You're defining out so it is not part of your repeating portion.
Move it down just under the `while` line so it looks like this:
```
<?php
$args = array( 'post_type' => 'products', 'posts_per_page' => 9 );
$the_query = new WP_Query( $args );
?>
<main class="site-content... |
363,123 | <p>I'm using WordPress admin to create a page (named <code>get-region-page</code>), in which Pod shortcode is used to retrieve the URL parameter. For example:</p>
<pre><code>[pods name="region" slug="{@get.regionparam}" field="region_name"]
</code></pre>
<p>With a redirection 301 to the URL <code>/get-region-page&... | [
{
"answer_id": 363096,
"author": "rudtek",
"author_id": 77767,
"author_profile": "https://wordpress.stackexchange.com/users/77767",
"pm_score": 3,
"selected": true,
"text": "<p>You need to define <code>$landscape</code> in the loop. You're defining out so it is not part of your repeatin... | 2020/04/03 | [
"https://wordpress.stackexchange.com/questions/363123",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185342/"
] | I'm using WordPress admin to create a page (named `get-region-page`), in which Pod shortcode is used to retrieve the URL parameter. For example:
```
[pods name="region" slug="{@get.regionparam}" field="region_name"]
```
With a redirection 301 to the URL `/get-region-page®ionparam=$region_slug`, the Pod shortcode ... | You need to define `$landscape` in the loop. You're defining out so it is not part of your repeating portion.
Move it down just under the `while` line so it looks like this:
```
<?php
$args = array( 'post_type' => 'products', 'posts_per_page' => 9 );
$the_query = new WP_Query( $args );
?>
<main class="site-content... |
363,139 | <p>So I've tried a few different ways to override a method inside the parent theme and I'm not having much luck at all.</p>
<p>So here is the structure:</p>
<blockquote>
<p>themes/<br>
- wp-starter<br>
-- custom_header.php<br>
- wp-starter-child<br>
-- custom_header.php</p>
</blockquote>
<p>I have a method... | [
{
"answer_id": 363178,
"author": "Himad",
"author_id": 158512,
"author_profile": "https://wordpress.stackexchange.com/users/158512",
"pm_score": 1,
"selected": false,
"text": "<p>Lower numbers have higher priority. Default priority is 10, so if you want an action to be executed before, t... | 2020/04/03 | [
"https://wordpress.stackexchange.com/questions/363139",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/173392/"
] | So I've tried a few different ways to override a method inside the parent theme and I'm not having much luck at all.
So here is the structure:
>
> themes/
>
> - wp-starter
>
> -- custom\_header.php
>
> - wp-starter-child
>
> -- custom\_header.php
>
>
>
I have a method inside the parent custom\_he... | You can't just redeclare the function in the child theme or call `add_action` a second time. It doesn't replace it, it adds a second hook. As a result, you haven't overriden it, you've duplicated the original. Child theme overrides only work for templates.
What's more, by adding a second definition of `wp_bootstrap_st... |
363,166 | <p>Im using ACF and trying to show a post type title based on the current time. So I have my post type entry with start_time and end_time and my conditional is showing my div.onAir, but Im getting this Recoverable Fatal Error. Here is my code:</p>
<pre><code><?php
$time_now = date("g:i a");
$shows = get_pos... | [
{
"answer_id": 363167,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<p><code>the_title</code> doesn't work that way:</p>\n<pre class=\"lang-php prettyprint-override\"><code>the_tit... | 2020/04/03 | [
"https://wordpress.stackexchange.com/questions/363166",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185384/"
] | Im using ACF and trying to show a post type title based on the current time. So I have my post type entry with start\_time and end\_time and my conditional is showing my div.onAir, but Im getting this Recoverable Fatal Error. Here is my code:
```
<?php
$time_now = date("g:i a");
$shows = get_posts( array(
... | `the_title` doesn't work that way:
```php
the_title( $before, $after, $echo );
```
`$before` is the text that comes before the title, but you didn't give it a string/text, you gave it a post object. Post objects aren't strings, PHP doesn't know what to do so it stops and prints an error instead.
For `the_title` to ... |
363,193 | <pre><code> function im_check_term($name,$tax){
$term = get_term_by("name", $name,$tax);
return !is_wp_error($term) ? $term->term_id : false;
}
</code></pre>
<p>Notice: Trying to get property of non-object in /home/pcodecom/demo.p30code.com/multimedia-2/wp-content/plugins/imdb/imdb.php on li... | [
{
"answer_id": 363167,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<p><code>the_title</code> doesn't work that way:</p>\n<pre class=\"lang-php prettyprint-override\"><code>the_tit... | 2020/04/04 | [
"https://wordpress.stackexchange.com/questions/363193",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185337/"
] | ```
function im_check_term($name,$tax){
$term = get_term_by("name", $name,$tax);
return !is_wp_error($term) ? $term->term_id : false;
}
```
Notice: Trying to get property of non-object in /home/pcodecom/demo.p30code.com/multimedia-2/wp-content/plugins/imdb/imdb.php on line 11 | `the_title` doesn't work that way:
```php
the_title( $before, $after, $echo );
```
`$before` is the text that comes before the title, but you didn't give it a string/text, you gave it a post object. Post objects aren't strings, PHP doesn't know what to do so it stops and prints an error instead.
For `the_title` to ... |
363,233 | <p>I am PHP newbie. I've got this code, and I want to pass global variable called $sum defined in function <code>post_order</code> to function <code>update_custom_meta</code>. Still no luck. What am I doing wrong?
Thank you in advance!</p>
<pre><code>function post_order() {
$args = array(
'type' => 'sho... | [
{
"answer_id": 363167,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<p><code>the_title</code> doesn't work that way:</p>\n<pre class=\"lang-php prettyprint-override\"><code>the_tit... | 2020/04/04 | [
"https://wordpress.stackexchange.com/questions/363233",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/184176/"
] | I am PHP newbie. I've got this code, and I want to pass global variable called $sum defined in function `post_order` to function `update_custom_meta`. Still no luck. What am I doing wrong?
Thank you in advance!
```
function post_order() {
$args = array(
'type' => 'shop_order',
'status' => 'processi... | `the_title` doesn't work that way:
```php
the_title( $before, $after, $echo );
```
`$before` is the text that comes before the title, but you didn't give it a string/text, you gave it a post object. Post objects aren't strings, PHP doesn't know what to do so it stops and prints an error instead.
For `the_title` to ... |
363,284 | <h3>Edit:</h3>
<h3>Where are the Woocommerce blocks located in Woocommerce code on Github? Answer:</h3>
<h3>As the answer underneath mentions the Woocommerce Block is a package so it is not shown on Github for the Woocommerce library but is called from: <a href="https://github.com/woocommerce/woocommerce-gutenberg-prod... | [
{
"answer_id": 363800,
"author": "Himad",
"author_id": 158512,
"author_profile": "https://wordpress.stackexchange.com/users/158512",
"pm_score": 1,
"selected": false,
"text": "<p>Woocommerce blocks are located at <code>woocommerce/packages/woocommerce-blocks/assets/js/blocks</code>.</p>\... | 2020/04/05 | [
"https://wordpress.stackexchange.com/questions/363284",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179478/"
] | ### Edit:
### Where are the Woocommerce blocks located in Woocommerce code on Github? Answer:
### As the answer underneath mentions the Woocommerce Block is a package so it is not shown on Github for the Woocommerce library but is called from: <https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/... | As the blocks more more and more to front-end rendering... there's only one filter that I've been able to find for modifying the output of the blocks via PHP. [`woocommerce_blocks_product_grid_item_html`](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b841c53f7ec0aa01ad4cd7f0f8f1e2d338708d9b/s... |
363,310 | <p>I'm writing a function in functions.php. I am working with woocommerce and trying to get posts with the same cat name of product_cat on single product pages. My idea is using the cat name of woocommerce cat and get_cat_ID() to get the category ID, then use WP_query to get the posts. However, get_cat_ID() always retu... | [
{
"answer_id": 363316,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p><code>get_cat_ID</code> gets the ID of a <em>category</em> based on the name. \"Category\" is a specifi... | 2020/04/05 | [
"https://wordpress.stackexchange.com/questions/363310",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185488/"
] | I'm writing a function in functions.php. I am working with woocommerce and trying to get posts with the same cat name of product\_cat on single product pages. My idea is using the cat name of woocommerce cat and get\_cat\_ID() to get the category ID, then use WP\_query to get the posts. However, get\_cat\_ID() always r... | For people who has the same problem:
I think the problem is caused by Polylang. I checked my category list on dashboard, and realized that the category I failed to get with get\_cat\_ID() doesn't belong to any language (which is weird). I created a test category and give assign a language to it, then get\_cat\_ID() wo... |
363,479 | <p>I need an unordered list, but with options selected for each list item. To achieve this I've created a custom block called icon-list which is a <code>ul</code> element with InnerBlocks, which allows only my custom icon-list-item block as a child. My icon-list-item block is just a RichText element with <code>tagName:... | [
{
"answer_id": 363316,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p><code>get_cat_ID</code> gets the ID of a <em>category</em> based on the name. \"Category\" is a specifi... | 2020/04/07 | [
"https://wordpress.stackexchange.com/questions/363479",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38894/"
] | I need an unordered list, but with options selected for each list item. To achieve this I've created a custom block called icon-list which is a `ul` element with InnerBlocks, which allows only my custom icon-list-item block as a child. My icon-list-item block is just a RichText element with `tagName: li` and some contr... | For people who has the same problem:
I think the problem is caused by Polylang. I checked my category list on dashboard, and realized that the category I failed to get with get\_cat\_ID() doesn't belong to any language (which is weird). I created a test category and give assign a language to it, then get\_cat\_ID() wo... |
363,641 | <p>I have a custom menu on a wordpress + woocommerce site using the Walker_Nav_Menu class. When hiding posts (products) from the site those posts and category are still included in the custom menu.
I would like to know how to remove either the specific product posts from this menu, for e.g. post ID = 6927 - or to remo... | [
{
"answer_id": 363316,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p><code>get_cat_ID</code> gets the ID of a <em>category</em> based on the name. \"Category\" is a specifi... | 2020/04/09 | [
"https://wordpress.stackexchange.com/questions/363641",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176497/"
] | I have a custom menu on a wordpress + woocommerce site using the Walker\_Nav\_Menu class. When hiding posts (products) from the site those posts and category are still included in the custom menu.
I would like to know how to remove either the specific product posts from this menu, for e.g. post ID = 6927 - or to remov... | For people who has the same problem:
I think the problem is caused by Polylang. I checked my category list on dashboard, and realized that the category I failed to get with get\_cat\_ID() doesn't belong to any language (which is weird). I created a test category and give assign a language to it, then get\_cat\_ID() wo... |
363,650 | <p>I am using Code Snippets plugins, that allow create shortcodes from the Wordpress Admin panel. I am using a simple shortcode to print some info and works great. Anyway, I want make this add some info if the parameter 'error' is in the url.</p>
<p>To make this, I am doing this:</p>
<pre><code>add_shortcode( 'my_sho... | [
{
"answer_id": 363702,
"author": "user1422434",
"author_id": 52814,
"author_profile": "https://wordpress.stackexchange.com/users/52814",
"pm_score": 2,
"selected": true,
"text": "<p>reading about this type of problems (because my template wasn't the problem) and it's a fresh installation... | 2020/04/09 | [
"https://wordpress.stackexchange.com/questions/363650",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/52814/"
] | I am using Code Snippets plugins, that allow create shortcodes from the Wordpress Admin panel. I am using a simple shortcode to print some info and works great. Anyway, I want make this add some info if the parameter 'error' is in the url.
To make this, I am doing this:
```
add_shortcode( 'my_shortcode', function () ... | reading about this type of problems (because my template wasn't the problem) and it's a fresh installation. I read that wordpress recommends the use of `$_REQUEST` instead `$_GET` (Anyway I see that other people can use `$_GET` without problems) and tried with `$_REQUEST`, now it's working. |
363,652 | <p>Every page on the admin dashboard is looking like this -- with "dead/empty" notification leftovers we cannot get rid of. NO new plugin was added and no plug-in update was made. Our code doesn't touch any admin page. </p>
<p>Is there any database table I can "zap" or drain to allow us to get rid of this annoying eff... | [
{
"answer_id": 364176,
"author": "uPrompt",
"author_id": 155077,
"author_profile": "https://wordpress.stackexchange.com/users/155077",
"pm_score": 0,
"selected": false,
"text": "<p>Can't post a comment so here goes.</p>\n\n<p>If you're not into writing or debugging code I'd try this:</p>... | 2020/04/09 | [
"https://wordpress.stackexchange.com/questions/363652",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/135990/"
] | Every page on the admin dashboard is looking like this -- with "dead/empty" notification leftovers we cannot get rid of. NO new plugin was added and no plug-in update was made. Our code doesn't touch any admin page.
Is there any database table I can "zap" or drain to allow us to get rid of this annoying effect.
**Th... | Let's take a look at `admin_notices`, since that's where your output is.
<https://core.trac.wordpress.org/browser/tags/5.4/src/wp-admin/admin-header.php#L281>
So, it's simply just an action-as-an-output-spot, what this means is that if you wish, you can output anything here and most importantly, this all happens in-m... |
363,680 | <p>I'm currently styling my single.php file and for some reason when compiled the page completely skips the first tag yet prints everything else afterwards, including the <code><h1></code> tag in the first <code><div></code>. The only fix I have produced at the moment is placing a blank <code><div></... | [
{
"answer_id": 364176,
"author": "uPrompt",
"author_id": 155077,
"author_profile": "https://wordpress.stackexchange.com/users/155077",
"pm_score": 0,
"selected": false,
"text": "<p>Can't post a comment so here goes.</p>\n\n<p>If you're not into writing or debugging code I'd try this:</p>... | 2020/04/09 | [
"https://wordpress.stackexchange.com/questions/363680",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185796/"
] | I'm currently styling my single.php file and for some reason when compiled the page completely skips the first tag yet prints everything else afterwards, including the `<h1>` tag in the first `<div>`. The only fix I have produced at the moment is placing a blank `<div>` tag before `<div class="page-header mb-5">` in or... | Let's take a look at `admin_notices`, since that's where your output is.
<https://core.trac.wordpress.org/browser/tags/5.4/src/wp-admin/admin-header.php#L281>
So, it's simply just an action-as-an-output-spot, what this means is that if you wish, you can output anything here and most importantly, this all happens in-m... |
363,703 | <p>I tried to write a very simple block plugin for Gutenberg: A simple TOC generator. I can now place a block in a post and the table of contents is being generated as an unordered list. Great! But in the backend (Gutenberg Editor) there is still my ugly block that just say "SimpleTOC" and is not dynamic. </p>
<p>How ... | [
{
"answer_id": 364176,
"author": "uPrompt",
"author_id": 155077,
"author_profile": "https://wordpress.stackexchange.com/users/155077",
"pm_score": 0,
"selected": false,
"text": "<p>Can't post a comment so here goes.</p>\n\n<p>If you're not into writing or debugging code I'd try this:</p>... | 2020/04/10 | [
"https://wordpress.stackexchange.com/questions/363703",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33797/"
] | I tried to write a very simple block plugin for Gutenberg: A simple TOC generator. I can now place a block in a post and the table of contents is being generated as an unordered list. Great! But in the backend (Gutenberg Editor) there is still my ugly block that just say "SimpleTOC" and is not dynamic.
How can I disp... | Let's take a look at `admin_notices`, since that's where your output is.
<https://core.trac.wordpress.org/browser/tags/5.4/src/wp-admin/admin-header.php#L281>
So, it's simply just an action-as-an-output-spot, what this means is that if you wish, you can output anything here and most importantly, this all happens in-m... |
363,731 | <p>Hi so for all my Wordpress 5.4 site’s posts (articles), I'm using Yoast SEO plugin for breadcrumbs across my site.</p>
<p>For all my posts (articles) I just want:</p>
<p>Home > CategoryLink > as breadcrumbs, not the topic of the post. </p>
<p>So I’ve tried the following code in my theme's functions.php:</p>
<pre... | [
{
"answer_id": 364176,
"author": "uPrompt",
"author_id": 155077,
"author_profile": "https://wordpress.stackexchange.com/users/155077",
"pm_score": 0,
"selected": false,
"text": "<p>Can't post a comment so here goes.</p>\n\n<p>If you're not into writing or debugging code I'd try this:</p>... | 2020/04/10 | [
"https://wordpress.stackexchange.com/questions/363731",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185836/"
] | Hi so for all my Wordpress 5.4 site’s posts (articles), I'm using Yoast SEO plugin for breadcrumbs across my site.
For all my posts (articles) I just want:
Home > CategoryLink > as breadcrumbs, not the topic of the post.
So I’ve tried the following code in my theme's functions.php:
```
add_filter( ‘wpseo_breadcru... | Let's take a look at `admin_notices`, since that's where your output is.
<https://core.trac.wordpress.org/browser/tags/5.4/src/wp-admin/admin-header.php#L281>
So, it's simply just an action-as-an-output-spot, what this means is that if you wish, you can output anything here and most importantly, this all happens in-m... |
363,870 | <p>I have a site that reviews movies (DVD/Blu-ray, etc.)So every review in a particular category will have (Blu-ray) after the title, another will have DVD and so forth. i.e. Avengers: Infinity War (Blu-ray). I want to trim the format of the disc (Blu-ray) from the page title and I have this code, but it's not working.... | [
{
"answer_id": 363895,
"author": "Will",
"author_id": 48698,
"author_profile": "https://wordpress.stackexchange.com/users/48698",
"pm_score": 0,
"selected": false,
"text": "<p>You have a couple options: </p>\n\n<p>You could use the <a href=\"https://wordpress.org/support/article/media-te... | 2020/04/12 | [
"https://wordpress.stackexchange.com/questions/363870",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34872/"
] | I have a site that reviews movies (DVD/Blu-ray, etc.)So every review in a particular category will have (Blu-ray) after the title, another will have DVD and so forth. i.e. Avengers: Infinity War (Blu-ray). I want to trim the format of the disc (Blu-ray) from the page title and I have this code, but it's not working. Wa... | Using the Align options you found (Align left, Align center, Align right) is often the easiest way to allow text to flow around your images in your WordPress posts.
1. Add the Image
2. Select Align right in Image options
3. Add some text (puts Image in Paragraph block)
4. Adjust the width of the Image block
so the tex... |
363,893 | <p>I am using Wordpress 5.4. I created a CPT using the code below:</p>
<pre><code>$args = array(
'labels' => $labels,
'description' => 'Some description',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'com... | [
{
"answer_id": 363900,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>has_archive was set to true and my understanding is that now when I goto /articles I am supp... | 2020/04/12 | [
"https://wordpress.stackexchange.com/questions/363893",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/29199/"
] | I am using Wordpress 5.4. I created a CPT using the code below:
```
$args = array(
'labels' => $labels,
'description' => 'Some description',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' ... | The solution to this problem is to use **Post name** in `/wp-admin/options-permalink.php`.
[](https://i.stack.imgur.com/UqytL.png) |
363,912 | <pre><code><img alt="Capital" data-inject-svg src="<?php bloginfo( 'template_url' ); ?>/assets/img/logos/imglogo.svg">
</code></pre>
<pre><code><img alt="Capital" data-inject-svg src="<?php echo get_template_directory_uri(); ?>/assets/img/logos/imglogo.svg">
</code></pre>
<p>i tried both of ab... | [
{
"answer_id": 363928,
"author": "Stoian Delev",
"author_id": 185752,
"author_profile": "https://wordpress.stackexchange.com/users/185752",
"pm_score": -1,
"selected": false,
"text": "<p>the answer ;) is : </p>\n\n<pre><code><img alt=\"Capital\" data-inject-svg src=\"<?php bloginfo... | 2020/04/13 | [
"https://wordpress.stackexchange.com/questions/363912",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185964/"
] | ```
<img alt="Capital" data-inject-svg src="<?php bloginfo( 'template_url' ); ?>/assets/img/logos/imglogo.svg">
```
```
<img alt="Capital" data-inject-svg src="<?php echo get_template_directory_uri(); ?>/assets/img/logos/imglogo.svg">
```
i tried both of above code but don't get output | remove "data-inject-svg" or use data="data-inject-svg" ...work great ...hire a screenshots
[](https://i.stack.imgur.com/jIDT8.png)
[](https://i.stack.imgur.com/9Mf3P.png) |
363,971 | <p>I looked at this question:</p>
<p><a href="https://wordpress.stackexchange.com/questions/253504/plugin-css-is-not-being-applied-to-the-page">plugin css is not being applied to the page?</a></p>
<p>but I couldnt solve my problem.</p>
<p>I use below code like the question:</p>
<pre><code> <?php
... | [
{
"answer_id": 363928,
"author": "Stoian Delev",
"author_id": 185752,
"author_profile": "https://wordpress.stackexchange.com/users/185752",
"pm_score": -1,
"selected": false,
"text": "<p>the answer ;) is : </p>\n\n<pre><code><img alt=\"Capital\" data-inject-svg src=\"<?php bloginfo... | 2020/04/13 | [
"https://wordpress.stackexchange.com/questions/363971",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180385/"
] | I looked at this question:
[plugin css is not being applied to the page?](https://wordpress.stackexchange.com/questions/253504/plugin-css-is-not-being-applied-to-the-page)
but I couldnt solve my problem.
I use below code like the question:
```
<?php
function libload()
{
... | remove "data-inject-svg" or use data="data-inject-svg" ...work great ...hire a screenshots
[](https://i.stack.imgur.com/jIDT8.png)
[](https://i.stack.imgur.com/9Mf3P.png) |
364,025 | <p>I have a wordpress installation where the posts also contain attachments that were not embedded in the content by using the <code>media library -> add</code>.</p>
<p>I would like to find all attachments that are not used in any posts/pages/custom_post_types</p>
<p>It is ok for me if I get results for attachment... | [
{
"answer_id": 364046,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": true,
"text": "<p>What you seek isn't truly possible. You can get sort of close, but you cannot definitively say if an attachme... | 2020/04/14 | [
"https://wordpress.stackexchange.com/questions/364025",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/182202/"
] | I have a wordpress installation where the posts also contain attachments that were not embedded in the content by using the `media library -> add`.
I would like to find all attachments that are not used in any posts/pages/custom\_post\_types
It is ok for me if I get results for attachments uploaded for a specific mon... | What you seek isn't truly possible. You can get sort of close, but you cannot definitively say if an attachment is or isn't in use.
We can get somewhere close to a solution, but to do this we will need to process each attachment individually.
So first, get a list of all the IDs of attachments. Use a standard `WP_Quer... |
364,066 | <p>I have a taxonomy called ORGANIZER.
All the terms of this taxonomy have a name and a description.
I tried to get the description of each term but i don't know how to loop on them.</p>
<p>I suppose i mus begin with:</p>
<pre><code>$terms = get_terms( array(
'taxonomy' => 'organizer',
'hide_empty' => f... | [
{
"answer_id": 364072,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"https://developer.wordpress.org/reference/functions/get_terms/\" rel=\"nofollow noreferrer\">... | 2020/04/14 | [
"https://wordpress.stackexchange.com/questions/364066",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/114630/"
] | I have a taxonomy called ORGANIZER.
All the terms of this taxonomy have a name and a description.
I tried to get the description of each term but i don't know how to loop on them.
I suppose i mus begin with:
```
$terms = get_terms( array(
'taxonomy' => 'organizer',
'hide_empty' => false,
) );
```
but could ... | [`get_terms()`](https://developer.wordpress.org/reference/functions/get_terms/) returns an array of [`WP_Term`](https://developer.wordpress.org/reference/classes/wp_term/) objects. To get the description, with the usual filters applied, you can pass this object to [`term_description()`](https://developer.wordpress.org/... |
364,077 | <p>Okay, so I programmed the following ajax code for my plugin, and I'm wondering why it's not working:</p>
<p>JavaScript:</p>
<pre><code>function myFunction() {
let dataContent = "hello";
let myData = {
// Nonce
_ajax_nonce: "<?php wp_create_nonce( 'nonce-name' );?>",
// Action Hook name for ... | [
{
"answer_id": 364119,
"author": "西門 正 Code Guy",
"author_id": 35701,
"author_profile": "https://wordpress.stackexchange.com/users/35701",
"pm_score": 2,
"selected": true,
"text": "<p>There are 4 filters to work with WordPress ajax.\nAccording to your description, the following condition... | 2020/04/14 | [
"https://wordpress.stackexchange.com/questions/364077",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/183929/"
] | Okay, so I programmed the following ajax code for my plugin, and I'm wondering why it's not working:
JavaScript:
```
function myFunction() {
let dataContent = "hello";
let myData = {
// Nonce
_ajax_nonce: "<?php wp_create_nonce( 'nonce-name' );?>",
// Action Hook name for Ajax Call
action: 'my_a... | There are 4 filters to work with WordPress ajax.
According to your description, the following conditions are assumed
* [`wp_ajax_{$action}`](https://developer.wordpress.org/reference/hooks/wp_ajax_action/) is for running in frontend and the user is logged in
* if echo something in the php file, it will not reflect in ... |
364,083 | <p>I'm having an issue processing a form.
The project was standalone PHP and I'm integrating it into Wordpress using this:</p>
<pre><code>require_once("../../../wp-load.php");
</code></pre>
<p>The form element is defined as:</p>
<pre><code><form id="new_post" name="new_post" class="form-horizontal" method="post" ... | [
{
"answer_id": 364119,
"author": "西門 正 Code Guy",
"author_id": 35701,
"author_profile": "https://wordpress.stackexchange.com/users/35701",
"pm_score": 2,
"selected": true,
"text": "<p>There are 4 filters to work with WordPress ajax.\nAccording to your description, the following condition... | 2020/04/14 | [
"https://wordpress.stackexchange.com/questions/364083",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36980/"
] | I'm having an issue processing a form.
The project was standalone PHP and I'm integrating it into Wordpress using this:
```
require_once("../../../wp-load.php");
```
The form element is defined as:
```
<form id="new_post" name="new_post" class="form-horizontal" method="post" enctype="multipart/form-data">
```
Now... | There are 4 filters to work with WordPress ajax.
According to your description, the following conditions are assumed
* [`wp_ajax_{$action}`](https://developer.wordpress.org/reference/hooks/wp_ajax_action/) is for running in frontend and the user is logged in
* if echo something in the php file, it will not reflect in ... |
364,095 | <p>I managed to finally get the ServerSideRender to work. But how do I reload the ServerSideRender when the post is saved? </p>
<pre><code> save: props => {
return null;
},
</code></pre>
<p>I think here I need something like a trigger to load the data again from my plugin.php Can somebody please tel... | [
{
"answer_id": 364805,
"author": "Marc",
"author_id": 33797,
"author_profile": "https://wordpress.stackexchange.com/users/33797",
"pm_score": 2,
"selected": true,
"text": "<p>I solved it with an \"update\" button in the block. It is a bit weird because I need to send \"fake\" attributes ... | 2020/04/14 | [
"https://wordpress.stackexchange.com/questions/364095",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33797/"
] | I managed to finally get the ServerSideRender to work. But how do I reload the ServerSideRender when the post is saved?
```
save: props => {
return null;
},
```
I think here I need something like a trigger to load the data again from my plugin.php Can somebody please tell me where to look? The serve... | I solved it with an "update" button in the block. It is a bit weird because I need to send "fake" attributes to re-render it. But it works.
```
var el = wp.element.createElement;
var registerBlockType = wp.blocks.registerBlockType;
var BlockControls = wp.blockEditor.BlockControls;
var ServerSideRender = wp.serverSideR... |
364,107 | <p>I found this code to functions.php</p>
<pre><code>add_filter( 'wp_default_editor', create_function('', 'return "html";') );
</code></pre>
<p>but I need to limit it to a specific set of roles (such as Editor or Author).</p>
<p>How do I do that?</p>
<p>Thanks!</p>
| [
{
"answer_id": 364112,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 0,
"selected": false,
"text": "<p>This should do it for you.</p>\n\n<pre><code>if ( current_user_can( 'editor' ) || current_user_can( 'auth... | 2020/04/14 | [
"https://wordpress.stackexchange.com/questions/364107",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/186114/"
] | I found this code to functions.php
```
add_filter( 'wp_default_editor', create_function('', 'return "html";') );
```
but I need to limit it to a specific set of roles (such as Editor or Author).
How do I do that?
Thanks! | `create_function()` is deprecated as of PHP 7.2.0, so you should avoid using it. Instead, use an [anonymous function](https://www.php.net/manual/en/functions.anonymous.php).
Additionally, it's better the check the current user role *inside* the callback function, so that the current user role is checked when the filt... |
364,177 | <p>I have a form that redirects to a payment platform and sends data in $_POST.</p>
<pre><code><form method="POST" action="https://www.paiementgateway.com/paiement/order1.pl" accept-charset="UTF8" id="knp-form" target="_top">
<table border="0" cellpadding="2" cellspacing="0" width="20%">
&l... | [
{
"answer_id": 364112,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 0,
"selected": false,
"text": "<p>This should do it for you.</p>\n\n<pre><code>if ( current_user_can( 'editor' ) || current_user_can( 'auth... | 2020/04/15 | [
"https://wordpress.stackexchange.com/questions/364177",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/186169/"
] | I have a form that redirects to a payment platform and sends data in $\_POST.
```
<form method="POST" action="https://www.paiementgateway.com/paiement/order1.pl" accept-charset="UTF8" id="knp-form" target="_top">
<table border="0" cellpadding="2" cellspacing="0" width="20%">
<meta charset="UTF-8">
... | `create_function()` is deprecated as of PHP 7.2.0, so you should avoid using it. Instead, use an [anonymous function](https://www.php.net/manual/en/functions.anonymous.php).
Additionally, it's better the check the current user role *inside* the callback function, so that the current user role is checked when the filt... |
364,211 | <p>i'm adding a function in my child theme's functions.php file that will only work on a specific page. </p>
<p>i can successfully Enqueue a 3rd-party jquery script.</p>
<p>and i can successfully add my own bit of jquery/js.</p>
<p>but i'm wondering if i can add these two things within the same function wrapper.</p>... | [
{
"answer_id": 364214,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 1,
"selected": false,
"text": "<p>The correct way to do this and make things easier for yourself is to put your secondary code into it's ow... | 2020/04/16 | [
"https://wordpress.stackexchange.com/questions/364211",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58663/"
] | i'm adding a function in my child theme's functions.php file that will only work on a specific page.
i can successfully Enqueue a 3rd-party jquery script.
and i can successfully add my own bit of jquery/js.
but i'm wondering if i can add these two things within the same function wrapper.
so here's the part for add... | The [`wp_add_inline_script()`](https://developer.wordpress.org/reference/functions/wp_add_inline_script/) is designed for this purpose. It lets you add some inline JavaScript above or below an enqueued script. You just need to pass the contents of the script, *without* `<script>` tags:
```
function custom_thing () {
... |
364,406 | <p>I would like specific users to only see the WooCommerce -> Settings -> Shipping menu. I've managed to remove other tabs e.g. Products, Payments, etc, but stuck on the following 2 things that I want to to accomplish:</p>
<ol>
<li>Remove the "GENERAL" Tab in WooCommerce Settings.</li>
<li>Remove the "ORDER STATUSES" ... | [
{
"answer_id": 364300,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<p><strong>Terms/Tags aren't ordered</strong>.</p>\n\n<p>To help make the terms easier to read, the editor will ... | 2020/04/17 | [
"https://wordpress.stackexchange.com/questions/364406",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/186344/"
] | I would like specific users to only see the WooCommerce -> Settings -> Shipping menu. I've managed to remove other tabs e.g. Products, Payments, etc, but stuck on the following 2 things that I want to to accomplish:
1. Remove the "GENERAL" Tab in WooCommerce Settings.
2. Remove the "ORDER STATUSES" Tab from a plugin. ... | **Terms/Tags aren't ordered**.
To help make the terms easier to read, the editor will list them alphabetically, but that isn't because they're ordered alphabetically in the database. It's because a piece of javascript sorted the terms in the UI control.
There is no order, only the order you give them. Fundamentally t... |
364,417 | <p>I'm entirely new to OOP, but trying to dip my toe in by creating a simple Recipes plugin. I have added a Recipes custom post type and a few meta fields to go along with it, and now I am trying to create a few template files for displaying the recipe meta and content. To do this, I am thinking it would be useful to... | [
{
"answer_id": 364420,
"author": "cameronjonesweb",
"author_id": 65582,
"author_profile": "https://wordpress.stackexchange.com/users/65582",
"pm_score": 2,
"selected": true,
"text": "<p>Your constructor requires the post ID to be passed to the class when it's instatiated, try this</p>\n\... | 2020/04/18 | [
"https://wordpress.stackexchange.com/questions/364417",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155285/"
] | I'm entirely new to OOP, but trying to dip my toe in by creating a simple Recipes plugin. I have added a Recipes custom post type and a few meta fields to go along with it, and now I am trying to create a few template files for displaying the recipe meta and content. To do this, I am thinking it would be useful to crea... | Your constructor requires the post ID to be passed to the class when it's instatiated, try this
`$recipe = new Wp_Recipes_Recipe( get_the_ID() );` |
364,448 | <p>When visiting wp-admin at the link <a href="http://ec2-3-16-54-250.us-east-2.compute.amazonaws.com/wp-admin" rel="nofollow noreferrer">http://ec2-3-16-54-250.us-east-2.compute.amazonaws.com/wp-admin</a>, I get the below URL</p>
<p><a href="http://ec2-3-16-54-250.us-east-2.compute.amazonaws.com/wp-admin/ec2-3-16-54-... | [
{
"answer_id": 364420,
"author": "cameronjonesweb",
"author_id": 65582,
"author_profile": "https://wordpress.stackexchange.com/users/65582",
"pm_score": 2,
"selected": true,
"text": "<p>Your constructor requires the post ID to be passed to the class when it's instatiated, try this</p>\n\... | 2020/04/18 | [
"https://wordpress.stackexchange.com/questions/364448",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/111544/"
] | When visiting wp-admin at the link <http://ec2-3-16-54-250.us-east-2.compute.amazonaws.com/wp-admin>, I get the below URL
<http://ec2-3-16-54-250.us-east-2.compute.amazonaws.com/wp-admin/ec2-3-16-54-250.us-east-2.compute.amazonaws.com/wp-login.php?redirect_to=http%3A%2F%2Fec2-3-16-54-250.us-east-2.compute.amazonaws.co... | Your constructor requires the post ID to be passed to the class when it's instatiated, try this
`$recipe = new Wp_Recipes_Recipe( get_the_ID() );` |
364,453 | <p>Recently I met the below code</p>
<pre><code>did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );
</code></pre>
<p>inside the file \wp-includes\script-loader.php</p>
<p>Does anyone knows what does it mean? Especially double ampersand between two commands. ... | [
{
"answer_id": 364454,
"author": "NextGenThemes",
"author_id": 38602,
"author_profile": "https://wordpress.stackexchange.com/users/38602",
"pm_score": 2,
"selected": false,
"text": "<p>I think its actually not allowed or discouraged in WP coding standards.</p>\n\n<p>Its is basically sayi... | 2020/04/18 | [
"https://wordpress.stackexchange.com/questions/364453",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134516/"
] | Recently I met the below code
```
did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );
```
inside the file \wp-includes\script-loader.php
Does anyone knows what does it mean? Especially double ampersand between two commands. I 've never met this syntax in PHP before an... | I think its actually not allowed or discouraged in WP coding standards.
Its is basically saying "If true go ahead".
It's a short form of this:
```
if ( did_action( 'init' ) ) {
$scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );
}
```
You can also think of this as if it's inside brackets ... |
364,562 | <p>I have a simple piece of "hello world" code I'm trying to execute on a page. I'm adding it using a PHP snippet:</p>
<pre><code>add_action( 'wp_head', function () { ?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
jQuery(document).ready(() => {
... | [
{
"answer_id": 364565,
"author": "K H",
"author_id": 137894,
"author_profile": "https://wordpress.stackexchange.com/users/137894",
"pm_score": -1,
"selected": false,
"text": "<p>It is always an headache working with jQuery in Wordpress.\nJust try replace second jQuery with $ sign. \nI gu... | 2020/04/20 | [
"https://wordpress.stackexchange.com/questions/364562",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/182134/"
] | I have a simple piece of "hello world" code I'm trying to execute on a page. I'm adding it using a PHP snippet:
```
add_action( 'wp_head', function () { ?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
jQuery(document).ready(() => {
jQuery('div#tm-extra-produ... | Try this.
```
add_action ( 'wp_head', 'custom_script_hook');
function custom_script_hook() {
?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<?php
$output='<script>
jQuery(document).ready(() => {
$("div#tm-extra-product-options... |
364,595 | <p>I am creating a post within <code>gform_after_submission</code> action, which sets a post ID variable when the post is successfully created.</p>
<p><a href="https://docs.gravityforms.com/gform_after_submission/" rel="nofollow noreferrer">https://docs.gravityforms.com/gform_after_submission/</a></p>
<pre><code>add_... | [
{
"answer_id": 364565,
"author": "K H",
"author_id": 137894,
"author_profile": "https://wordpress.stackexchange.com/users/137894",
"pm_score": -1,
"selected": false,
"text": "<p>It is always an headache working with jQuery in Wordpress.\nJust try replace second jQuery with $ sign. \nI gu... | 2020/04/20 | [
"https://wordpress.stackexchange.com/questions/364595",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/111152/"
] | I am creating a post within `gform_after_submission` action, which sets a post ID variable when the post is successfully created.
<https://docs.gravityforms.com/gform_after_submission/>
```
add_action('gform_after_submission_1', [ $this, 'create_order' ], 10, 2 );
public function create_order( $entry, $form ) {
... | Try this.
```
add_action ( 'wp_head', 'custom_script_hook');
function custom_script_hook() {
?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<?php
$output='<script>
jQuery(document).ready(() => {
$("div#tm-extra-product-options... |
364,598 | <p>Each user has a user meta called profile_url chosen during registration.
After user creation, a page with that slug is created and made private (the author of the page is the admin).
The user in his front-end dashboard has the possibility to make this page public or private.
When the page is private, the owner user ... | [
{
"answer_id": 364565,
"author": "K H",
"author_id": 137894,
"author_profile": "https://wordpress.stackexchange.com/users/137894",
"pm_score": -1,
"selected": false,
"text": "<p>It is always an headache working with jQuery in Wordpress.\nJust try replace second jQuery with $ sign. \nI gu... | 2020/04/20 | [
"https://wordpress.stackexchange.com/questions/364598",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/186515/"
] | Each user has a user meta called profile\_url chosen during registration.
After user creation, a page with that slug is created and made private (the author of the page is the admin).
The user in his front-end dashboard has the possibility to make this page public or private.
When the page is private, the owner user ca... | Try this.
```
add_action ( 'wp_head', 'custom_script_hook');
function custom_script_hook() {
?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<?php
$output='<script>
jQuery(document).ready(() => {
$("div#tm-extra-product-options... |
364,676 | <p>We display event dates/times via Wordpress <a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="nofollow noreferrer">date and time</a> functions in am/pm time (12 hour, not 24 hour). For any times that are noon - i.e. "12:00 pm" - we'd like to display "12:00 noon" instead. </p>
<p>And we'd... | [
{
"answer_id": 364685,
"author": "Sam",
"author_id": 186246,
"author_profile": "https://wordpress.stackexchange.com/users/186246",
"pm_score": 0,
"selected": false,
"text": "<p>I think you can Do it with Translation loops! Simply find the \"12:00 pm\" and put 12:00 Noon. Maybe It works! ... | 2020/04/21 | [
"https://wordpress.stackexchange.com/questions/364676",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2495/"
] | We display event dates/times via Wordpress [date and time](https://wordpress.org/support/article/formatting-date-and-time/) functions in am/pm time (12 hour, not 24 hour). For any times that are noon - i.e. "12:00 pm" - we'd like to display "12:00 noon" instead.
And we'd also like to display "12:00 midnight" instead ... | So what you need to do is make your life easier and instead of searching everything within every instance of `.pp-post-content` or `.pp-post-content p`, let's wrap the times or the times in question with a span tag. Like you suggested in your comments `<span class="tas-event-time">` is sufficient enough.
Now, in your ... |
364,679 | <p>All guest comments are <code>user_id = 0</code>, while registered users have their unique <code>user_id</code> attach to the comment. How to edit comment <code>user_id</code> from the comment edit screen.</p>
<p>I think I need to use edit_comment and add_meta_boxes_comment hooks.</p>
| [
{
"answer_id": 364950,
"author": "Chetan Vaghela",
"author_id": 169856,
"author_profile": "https://wordpress.stackexchange.com/users/169856",
"pm_score": 2,
"selected": false,
"text": "<p>You can take reference from below code. It will provide an option to update user id of comment (<a h... | 2020/04/21 | [
"https://wordpress.stackexchange.com/questions/364679",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/145504/"
] | All guest comments are `user_id = 0`, while registered users have their unique `user_id` attach to the comment. How to edit comment `user_id` from the comment edit screen.
I think I need to use edit\_comment and add\_meta\_boxes\_comment hooks. | Thanks, everyone for the answers. I already solved it. This is my code. I was trying `edit_comment` at the time of questioning.
```
function wp_review_id_metabox_full() {
if (get_comment_type($comment->comment_ID) == 'wp_review_comment') {
add_meta_box('some_meta_box_name', __( 'ID: ' ), 'wp_review_id_... |
364,680 | <p>I'm trying to embed this code: <a href="https://codepen.io/jme11/pen/zMVJVX" rel="nofollow noreferrer">https://codepen.io/jme11/pen/zMVJVX</a></p>
<p>into my Wordpress about fitness, but I don't know why it's not working correctly - </p>
<p>I've downloaded the export of the code, which works perfectly in the stand... | [
{
"answer_id": 364950,
"author": "Chetan Vaghela",
"author_id": 169856,
"author_profile": "https://wordpress.stackexchange.com/users/169856",
"pm_score": 2,
"selected": false,
"text": "<p>You can take reference from below code. It will provide an option to update user id of comment (<a h... | 2020/04/21 | [
"https://wordpress.stackexchange.com/questions/364680",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/174612/"
] | I'm trying to embed this code: <https://codepen.io/jme11/pen/zMVJVX>
into my Wordpress about fitness, but I don't know why it's not working correctly -
I've downloaded the export of the code, which works perfectly in the standalone HTML (+ js and css) file (specifically the completed form will display in the results... | Thanks, everyone for the answers. I already solved it. This is my code. I was trying `edit_comment` at the time of questioning.
```
function wp_review_id_metabox_full() {
if (get_comment_type($comment->comment_ID) == 'wp_review_comment') {
add_meta_box('some_meta_box_name', __( 'ID: ' ), 'wp_review_id_... |
364,681 | <p>I wanna know, what are the <strong>hooks</strong> in wp themes, like before_header_hook, after_header_hook?
What are the uses and benefits of these hooks in theme development?</p>
| [
{
"answer_id": 364696,
"author": "Amir",
"author_id": 80135,
"author_profile": "https://wordpress.stackexchange.com/users/80135",
"pm_score": 1,
"selected": false,
"text": "<p>Whenever you want to do something or customize something in WordPress, then there is very likely a hook you can ... | 2020/04/21 | [
"https://wordpress.stackexchange.com/questions/364681",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/186599/"
] | I wanna know, what are the **hooks** in wp themes, like before\_header\_hook, after\_header\_hook?
What are the uses and benefits of these hooks in theme development? | WordPress is a whole package of different code components working together to provide a functional Content Management System. WordPress Core, Plugins, and Themes are all part of this package. Since some of these components update separately you do not want to edit the code directly, otherwise your changes will be overw... |
364,791 | <p>I started getting international visits but how do I make my site multi-language? Is there a good plugin or what do I have to do?</p>
| [
{
"answer_id": 364696,
"author": "Amir",
"author_id": 80135,
"author_profile": "https://wordpress.stackexchange.com/users/80135",
"pm_score": 1,
"selected": false,
"text": "<p>Whenever you want to do something or customize something in WordPress, then there is very likely a hook you can ... | 2020/04/22 | [
"https://wordpress.stackexchange.com/questions/364791",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/186686/"
] | I started getting international visits but how do I make my site multi-language? Is there a good plugin or what do I have to do? | WordPress is a whole package of different code components working together to provide a functional Content Management System. WordPress Core, Plugins, and Themes are all part of this package. Since some of these components update separately you do not want to edit the code directly, otherwise your changes will be overw... |
364,807 | <p>I am trying to add some PHP code before my WooCommerce product page sidebar content and can't for the life of me find where to do that. I have tried editing sidebar.php, using the 'woocommerce_sidebar' hook but cannot make this work.</p>
<p>I simply want some PHP code to be visible above the widget content in <code... | [
{
"answer_id": 364696,
"author": "Amir",
"author_id": 80135,
"author_profile": "https://wordpress.stackexchange.com/users/80135",
"pm_score": 1,
"selected": false,
"text": "<p>Whenever you want to do something or customize something in WordPress, then there is very likely a hook you can ... | 2020/04/22 | [
"https://wordpress.stackexchange.com/questions/364807",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/186573/"
] | I am trying to add some PHP code before my WooCommerce product page sidebar content and can't for the life of me find where to do that. I have tried editing sidebar.php, using the 'woocommerce\_sidebar' hook but cannot make this work.
I simply want some PHP code to be visible above the widget content in `<div class="s... | WordPress is a whole package of different code components working together to provide a functional Content Management System. WordPress Core, Plugins, and Themes are all part of this package. Since some of these components update separately you do not want to edit the code directly, otherwise your changes will be overw... |
364,875 | <p>I have this custom structure set for my permalinks: /archive/%postname%</p>
<p>With this, my URLs show as example.com/parent/child, which is the desired behavior. However, I'm adding a custom post type and this permalink structure is causing undesired URLs for the CPT. I want the permalink to be example.com/news/... | [
{
"answer_id": 364879,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 0,
"selected": false,
"text": "<p>You can just use the \"Post name\" permalink structure, which is the same as <code>/%postname%/</code>. P... | 2020/04/23 | [
"https://wordpress.stackexchange.com/questions/364875",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/183146/"
] | I have this custom structure set for my permalinks: /archive/%postname%
With this, my URLs show as example.com/parent/child, which is the desired behavior. However, I'm adding a custom post type and this permalink structure is causing undesired URLs for the CPT. I want the permalink to be example.com/news/headline, bu... | Disable the `with_front` on `rewrite` while `register_post_type`.
In your case:
```
register_post_type('news', array(
...
'public' => true,
'rewrite' => array('slug' => 'news', 'with_front'=> false),
'supports' => array( 'title', 'page-attributes', 'editor', 'custom-fields')
));
``` |
364,920 | <p>I was wondering how can I load parent theme template parts through child theme after customization. I have created three custom template for my theme and they are working fine. But now I want to load parent theme template parts layout. For example if I want edit profile page the location of the PHP file in parent th... | [
{
"answer_id": 364922,
"author": "Amir",
"author_id": 80135,
"author_profile": "https://wordpress.stackexchange.com/users/80135",
"pm_score": -1,
"selected": false,
"text": "<p>For every theme file present in the parent directory, WordPress will check whether a corresponding file is pres... | 2020/04/24 | [
"https://wordpress.stackexchange.com/questions/364920",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105528/"
] | I was wondering how can I load parent theme template parts through child theme after customization. I have created three custom template for my theme and they are working fine. But now I want to load parent theme template parts layout. For example if I want edit profile page the location of the PHP file in parent theme... | From the [WordPress documentation on child themes (Referencing or Including Other Files)](https://developer.wordpress.org/themes/advanced-topics/child-themes/#referencing-or-including-other-files):
>
> To reference the parent theme directory, you would use
> get\_template\_directory() instead.
>
>
>
Therefore, in... |
364,929 | <p>I'm following <a href="https://make.wordpress.org/cli/handbook/plugin-unit-tests/" rel="nofollow noreferrer">https://make.wordpress.org/cli/handbook/plugin-unit-tests/</a> to run unit tests for plugins.</p>
<p>I create a new plugin.</p>
<pre><code>$ wp scaffold plugin hello-plugin-1
Success: Created plugin files.
... | [
{
"answer_id": 364922,
"author": "Amir",
"author_id": 80135,
"author_profile": "https://wordpress.stackexchange.com/users/80135",
"pm_score": -1,
"selected": false,
"text": "<p>For every theme file present in the parent directory, WordPress will check whether a corresponding file is pres... | 2020/04/24 | [
"https://wordpress.stackexchange.com/questions/364929",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/185727/"
] | I'm following <https://make.wordpress.org/cli/handbook/plugin-unit-tests/> to run unit tests for plugins.
I create a new plugin.
```
$ wp scaffold plugin hello-plugin-1
Success: Created plugin files.
Success: Created test files.
```
Run `install-wp-tests.sh`.
```
$ cd wp-content/plugins/hello-plugin-1
$ ./bin/inst... | From the [WordPress documentation on child themes (Referencing or Including Other Files)](https://developer.wordpress.org/themes/advanced-topics/child-themes/#referencing-or-including-other-files):
>
> To reference the parent theme directory, you would use
> get\_template\_directory() instead.
>
>
>
Therefore, in... |