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 |
|---|---|---|---|---|---|---|
326,534 | <p>You have used the code of this question (<a href="https://wordpress.stackexchange.com/questions/74235/show-content-after-the-first-and-second-paragraph">Show content after the first and second paragraph</a>) and it works correctly for me. </p>
<pre><code> <?php
$paragraphAfter[1] = '<div>AFTER FIRST<... | [
{
"answer_id": 332375,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": false,
"text": "<p>The closest I can find in <a href=\"https://wordpress.org/gutenberg/handbook/designers-developers/develop... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326534",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159674/"
] | You have used the code of this question ([Show content after the first and second paragraph](https://wordpress.stackexchange.com/questions/74235/show-content-after-the-first-and-second-paragraph)) and it works correctly for me.
```
<?php
$paragraphAfter[1] = '<div>AFTER FIRST</div>'; //display after the first par... | The closest I can find in [the documentation](https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/) is disabling custom font size (the text input) and forcing the dropdown font size to only contain "Normal".
```
add_action('after_setup_theme', 'wpse_remove_custom_colors');
fun... |
326,536 | <p>I migrated my website from one hosting to another by importing the DB and reinstalling the old exported DB on the new hosting. I have also re-installed the wordpress template. The result is the following: </p>
<p><a href="https://www.sea-dobbiaco.bz.it/" rel="nofollow noreferrer">https://www.sea-dobbiaco.bz.it/</a>... | [
{
"answer_id": 332375,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": false,
"text": "<p>The closest I can find in <a href=\"https://wordpress.org/gutenberg/handbook/designers-developers/develop... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326536",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159752/"
] | I migrated my website from one hosting to another by importing the DB and reinstalling the old exported DB on the new hosting. I have also re-installed the wordpress template. The result is the following:
<https://www.sea-dobbiaco.bz.it/>
The original home page is as follows, and on the old hosting it worked well.
... | The closest I can find in [the documentation](https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/) is disabling custom font size (the text input) and forcing the dropdown font size to only contain "Normal".
```
add_action('after_setup_theme', 'wpse_remove_custom_colors');
fun... |
326,540 | <p>For a menu which has only top-level links to custom post type archive pages, how can I add the <code>.active</code> class to the top-level item when viewing that post type's single?</p>
<p>There's lots of similar questions on WPSE (like <a href="https://stackoverflow.com/questions/26789438/how-to-add-active-class-t... | [
{
"answer_id": 332375,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": false,
"text": "<p>The closest I can find in <a href=\"https://wordpress.org/gutenberg/handbook/designers-developers/develop... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326540",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/64117/"
] | For a menu which has only top-level links to custom post type archive pages, how can I add the `.active` class to the top-level item when viewing that post type's single?
There's lots of similar questions on WPSE (like [this](https://stackoverflow.com/questions/26789438/how-to-add-active-class-to-wp-nav-menu-current-m... | The closest I can find in [the documentation](https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/) is disabling custom font size (the text input) and forcing the dropdown font size to only contain "Normal".
```
add_action('after_setup_theme', 'wpse_remove_custom_colors');
fun... |
326,575 | <p>The Codex disagrees with itself, so I'm stumped.</p>
<p>On <code>single.php</code> I am trying to use <code>next_post_link()</code> to display a link to the next post, with custom link text, within the same category as the current post.</p>
<p>The <a href="https://codex.wordpress.org/Function_Reference/next_post_l... | [
{
"answer_id": 326577,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 0,
"selected": false,
"text": "<p>Ok, this seems silly, but for some reason lowercasing the \"true\" solved the problem.</p>\n\n<p><code>&l... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326575",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/102815/"
] | The Codex disagrees with itself, so I'm stumped.
On `single.php` I am trying to use `next_post_link()` to display a link to the next post, with custom link text, within the same category as the current post.
The [Codex article on `next_post_link()`](https://codex.wordpress.org/Function_Reference/next_post_link) says ... | OK, so there's a problem with Codes in this part, I guess.
>
> The Codex article on Next and Previous Links contradicts the article
> specifically on next\_post\_link()
>
>
>
In that article you can clearly see, that it looked a little bit different. In the part describing `next_post_link` there is a note:
>
>... |
326,580 | <p>I need a WordPress menu item to link to a custom url like the following:</p>
<pre><code>http://www.example.com/my-page#my-anchor
</code></pre>
<p>Yet, WordPress adds a slash before the hash sign and reformats the custom link to</p>
<pre><code>http://www.example.com/my-page/#my-anchor
</code></pre>
<p>thus invali... | [
{
"answer_id": 326597,
"author": "admcfajn",
"author_id": 123674,
"author_profile": "https://wordpress.stackexchange.com/users/123674",
"pm_score": 1,
"selected": false,
"text": "<p>You can likely change that by removing the slash from the end of the permalink structure on <code>wp-admin... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326580",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159782/"
] | I need a WordPress menu item to link to a custom url like the following:
```
http://www.example.com/my-page#my-anchor
```
Yet, WordPress adds a slash before the hash sign and reformats the custom link to
```
http://www.example.com/my-page/#my-anchor
```
thus invalidating the jQuery call I need. | You can likely change that by removing the slash from the end of the permalink structure on `wp-admin/options-permalink.php` & you should be good to go.
[](https://i.stack.imgur.com/9e9cW.png)
But as [Krzysiek Dróżdż](https://wordpress.stackexchange.... |
326,613 | <p>I'm building a theme using Gutenberg for the first time. In the past, I've built custom post types like this:</p>
<pre><code>// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Post Types', 'Post Type General Name', 'text_domain' ),
'si... | [
{
"answer_id": 326614,
"author": "Sam",
"author_id": 37548,
"author_profile": "https://wordpress.stackexchange.com/users/37548",
"pm_score": 4,
"selected": true,
"text": "<p>Yep, you just need to add <code>'show_in_rest' => true</code></p>\n\n<p>Here's the full snippet:</p>\n\n<pre><c... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326613",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37548/"
] | I'm building a theme using Gutenberg for the first time. In the past, I've built custom post types like this:
```
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Post Types', 'Post Type General Name', 'text_domain' ),
'singular_name' ... | Yep, you just need to add `'show_in_rest' => true`
Here's the full snippet:
```
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Post Types', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Post Type', 'Post Typ... |
326,617 | <p>I want to remove bulk action for non admin user (shop manager to be specific),
so I got this code that let me to remove the bulk action for all users.</p>
<pre><code>add_filter( 'bulk_actions-edit-shop_order', '__return_empty_array', 100 );
</code></pre>
<p>How can I make it working only for the shop manager role ... | [
{
"answer_id": 326614,
"author": "Sam",
"author_id": 37548,
"author_profile": "https://wordpress.stackexchange.com/users/37548",
"pm_score": 4,
"selected": true,
"text": "<p>Yep, you just need to add <code>'show_in_rest' => true</code></p>\n\n<p>Here's the full snippet:</p>\n\n<pre><c... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326617",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159814/"
] | I want to remove bulk action for non admin user (shop manager to be specific),
so I got this code that let me to remove the bulk action for all users.
```
add_filter( 'bulk_actions-edit-shop_order', '__return_empty_array', 100 );
```
How can I make it working only for the shop manager role users?
I also tried [this... | Yep, you just need to add `'show_in_rest' => true`
Here's the full snippet:
```
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Post Types', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Post Type', 'Post Typ... |
326,658 | <p>I have a custom post type "projets" that is using the category taxonomy (so it is sharing categories with regular posts).</p>
<p>When I call WP_Query like this:</p>
<pre><code>$args = array(
'post_type' => 'projets',
'posts_per_page' => 6,
'paged' => (get_query_var('paged')) ? get_query_var('p... | [
{
"answer_id": 326674,
"author": "Jaydip Nimavat",
"author_id": 123295,
"author_profile": "https://wordpress.stackexchange.com/users/123295",
"pm_score": 0,
"selected": false,
"text": "<p>You can not pass CAT parameter for the custom taxonomy. you have to use tax_query. </p>\n\n<p>Refere... | 2019/01/25 | [
"https://wordpress.stackexchange.com/questions/326658",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16762/"
] | I have a custom post type "projets" that is using the category taxonomy (so it is sharing categories with regular posts).
When I call WP\_Query like this:
```
$args = array(
'post_type' => 'projets',
'posts_per_page' => 6,
'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1,
);
$projects = ne... | Assuming that you have a CPT with slug `projets` and you've registered built-in categories for that CPT, it all looks correct.
So there are two possibilities, that I would check:
1. Typos - maybe you misstyped your CPT name somewhere in your code.
2. `pre_get_posts` filter is modifying your query and changing its beh... |
326,688 | <p>When I add a filter to custom get_all_posts API callback, API works, but the admin page for each page is blank. Why?</p>
<pre><code>function get_all_posts( $data, $post, $context ) {
return [
'id' => $data->data['id'],
'date' => $data->data['date'],
'date_gmt' =... | [
{
"answer_id": 326674,
"author": "Jaydip Nimavat",
"author_id": 123295,
"author_profile": "https://wordpress.stackexchange.com/users/123295",
"pm_score": 0,
"selected": false,
"text": "<p>You can not pass CAT parameter for the custom taxonomy. you have to use tax_query. </p>\n\n<p>Refere... | 2019/01/25 | [
"https://wordpress.stackexchange.com/questions/326688",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159869/"
] | When I add a filter to custom get\_all\_posts API callback, API works, but the admin page for each page is blank. Why?
```
function get_all_posts( $data, $post, $context ) {
return [
'id' => $data->data['id'],
'date' => $data->data['date'],
'date_gmt' => $data->data['date_gmt'... | Assuming that you have a CPT with slug `projets` and you've registered built-in categories for that CPT, it all looks correct.
So there are two possibilities, that I would check:
1. Typos - maybe you misstyped your CPT name somewhere in your code.
2. `pre_get_posts` filter is modifying your query and changing its beh... |
326,708 | <p>So, I'm in the process of writing a plugin for a specific site.</p>
<p>I understand WordPress picks the page template from the theme, with php script names according to the chart below. However, I'd like to write a script for my plugin and have WordPress include my script when it searches for the page template.</p>... | [
{
"answer_id": 326714,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 4,
"selected": true,
"text": "<p>WordPress has a <code>template_include</code> filter which you can use.</p>\n\n<pre><code>// Add a filter ... | 2019/01/25 | [
"https://wordpress.stackexchange.com/questions/326708",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/80614/"
] | So, I'm in the process of writing a plugin for a specific site.
I understand WordPress picks the page template from the theme, with php script names according to the chart below. However, I'd like to write a script for my plugin and have WordPress include my script when it searches for the page template.
I know this ... | WordPress has a `template_include` filter which you can use.
```
// Add a filter to 'template_include' hook
add_filter( 'template_include', 'wpse_force_template' );
function wpse_force_template( $template ) {
// If the current url is an archive of any kind
if( is_archive() ) {
// Set this to the templa... |
326,742 | <p>I want to add some content, in the top or bottom of the wordpress edit.php page for a custom post type. What is the right filter or way to do this ? </p>
| [
{
"answer_id": 326754,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": -1,
"selected": false,
"text": "<p>Try following these lines to add html content to <strong>edit.php</strong>:</p>\n<pre><code>... | 2019/01/26 | [
"https://wordpress.stackexchange.com/questions/326742",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/136480/"
] | I want to add some content, in the top or bottom of the wordpress edit.php page for a custom post type. What is the right filter or way to do this ? | The action `load-edit.php` is not needed. The answer on Stack Overflow is based on this WPSE answer: [How do you create a custom edit.php / edit pages page](https://wordpress.stackexchange.com/a/115164/12615) that uses `pre_get_posts`, that's why it was encapsulated inside `load-PAGE` action.
On the screen `edit.php` ... |
326,781 | <p>I have a piece of code that outputs my post title but how can I output it as an H4?</p>
<p>Here is the code I have: <code><?php echo get_the_title( $post_id ); ?></code>
Thanks</p>
| [
{
"answer_id": 326782,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 1,
"selected": true,
"text": "<p>Using your example, you could...</p>\n\n<pre><code><h4><?php echo get_the_title( $post_id ); ?&g... | 2019/01/26 | [
"https://wordpress.stackexchange.com/questions/326781",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/146090/"
] | I have a piece of code that outputs my post title but how can I output it as an H4?
Here is the code I have: `<?php echo get_the_title( $post_id ); ?>`
Thanks | Using your example, you could...
```
<h4><?php echo get_the_title( $post_id ); ?></h4>
```
Or
```
$h4 = get_the_title();
echo '<h4>' . $h4 . '</h4>';
```
More on [get\_the\_title()](https://developer.wordpress.org/reference/functions/get_the_title/).
Or you could use [the\_title()](https://codex.wordpress.org/Fu... |
326,795 | <p>How to add custom settings in the side panel that shows when a block is active? For example Paragraph block has "Text Settings" and "Custom Size" options, how can I add options to my custom block?</p>
<p>This tutorial: <a href="https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/block... | [
{
"answer_id": 326823,
"author": "obiPlabon",
"author_id": 135737,
"author_profile": "https://wordpress.stackexchange.com/users/135737",
"pm_score": 4,
"selected": true,
"text": "<p>Actually <code>InspectorControls</code> is not deprecated. It's been moved to another namespace or under a... | 2019/01/26 | [
"https://wordpress.stackexchange.com/questions/326795",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/85390/"
] | How to add custom settings in the side panel that shows when a block is active? For example Paragraph block has "Text Settings" and "Custom Size" options, how can I add options to my custom block?
This tutorial: <https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/block-tutorial/block-co... | Actually `InspectorControls` is not deprecated. It's been moved to another namespace or under a different object, which is `wp.editor`. So the latest way of adding controls in side panel is the following (in JSX) -
```
// Destruct components
// Place at the top of the block file
const { InspectorControls } = wp.editor... |
326,849 | <p>I use a plugin (<a href="https://wordpress.org/plugins/companion-auto-update/" rel="nofollow noreferrer">Companion Auto Update</a>) for auto-update plugins.
<a href="https://wordpress.org/support/topic/updraftplus-backup-restore-is-not-autoupdating/page/2/#post-11129722" rel="nofollow noreferrer">This is using the c... | [
{
"answer_id": 326823,
"author": "obiPlabon",
"author_id": 135737,
"author_profile": "https://wordpress.stackexchange.com/users/135737",
"pm_score": 4,
"selected": true,
"text": "<p>Actually <code>InspectorControls</code> is not deprecated. It's been moved to another namespace or under a... | 2019/01/27 | [
"https://wordpress.stackexchange.com/questions/326849",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159987/"
] | I use a plugin ([Companion Auto Update](https://wordpress.org/plugins/companion-auto-update/)) for auto-update plugins.
[This is using the core function of Wordpress](https://wordpress.org/support/topic/updraftplus-backup-restore-is-not-autoupdating/page/2/#post-11129722) where you can force auto-update for plugins.
... | Actually `InspectorControls` is not deprecated. It's been moved to another namespace or under a different object, which is `wp.editor`. So the latest way of adding controls in side panel is the following (in JSX) -
```
// Destruct components
// Place at the top of the block file
const { InspectorControls } = wp.editor... |
326,854 | <p>First off let me explain what I mean.
I work on a company that got a WP page with a theme installed and a load of plugins, like YOAST, WooCommerce, more plugins for woo commerce etc etc.
Those plugins and the theme itself, generate javascript code for our main webpage.
Obviously, that is far from optimized and that... | [
{
"answer_id": 326823,
"author": "obiPlabon",
"author_id": 135737,
"author_profile": "https://wordpress.stackexchange.com/users/135737",
"pm_score": 4,
"selected": true,
"text": "<p>Actually <code>InspectorControls</code> is not deprecated. It's been moved to another namespace or under a... | 2019/01/27 | [
"https://wordpress.stackexchange.com/questions/326854",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159988/"
] | First off let me explain what I mean.
I work on a company that got a WP page with a theme installed and a load of plugins, like YOAST, WooCommerce, more plugins for woo commerce etc etc.
Those plugins and the theme itself, generate javascript code for our main webpage.
Obviously, that is far from optimized and that's ... | Actually `InspectorControls` is not deprecated. It's been moved to another namespace or under a different object, which is `wp.editor`. So the latest way of adding controls in side panel is the following (in JSX) -
```
// Destruct components
// Place at the top of the block file
const { InspectorControls } = wp.editor... |
326,865 | <p>My website is in English Language and using WordPress.</p>
<p>Html Code contains <b>lang="en-US" </b>only. </p>
<p>But I want some of the page in other language like Spanish, Arabic and German.</p>
<p>When I create new page it is by default lang="en-US".</p>
<p>How can I set this lang="es" or specific language a... | [
{
"answer_id": 326823,
"author": "obiPlabon",
"author_id": 135737,
"author_profile": "https://wordpress.stackexchange.com/users/135737",
"pm_score": 4,
"selected": true,
"text": "<p>Actually <code>InspectorControls</code> is not deprecated. It's been moved to another namespace or under a... | 2019/01/27 | [
"https://wordpress.stackexchange.com/questions/326865",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155491/"
] | My website is in English Language and using WordPress.
Html Code contains **lang="en-US"** only.
But I want some of the page in other language like Spanish, Arabic and German.
When I create new page it is by default lang="en-US".
How can I set this lang="es" or specific language attribute?
I have tried many plugi... | Actually `InspectorControls` is not deprecated. It's been moved to another namespace or under a different object, which is `wp.editor`. So the latest way of adding controls in side panel is the following (in JSX) -
```
// Destruct components
// Place at the top of the block file
const { InspectorControls } = wp.editor... |
326,869 | <p>When adding the "Latest Posts" block within Gutenberg, is it possible to filter by custom post type?</p>
<p>Here are the options I can see: </p>
<p><a href="https://i.stack.imgur.com/B9GzP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B9GzP.png" alt="enter image description here"></a></p>
<p>... | [
{
"answer_id": 339376,
"author": "hozefa Saleh",
"author_id": 113641,
"author_profile": "https://wordpress.stackexchange.com/users/113641",
"pm_score": 2,
"selected": false,
"text": "<p>Why not create your own custom post display block using this easy to use plugin lazyblock <a href=\"ht... | 2019/01/27 | [
"https://wordpress.stackexchange.com/questions/326869",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37548/"
] | When adding the "Latest Posts" block within Gutenberg, is it possible to filter by custom post type?
Here are the options I can see:
[](https://i.stack.imgur.com/B9GzP.png)
Would I need to create a custom block for this type of functionality?
I've... | It's Not (Reasonably) Possible (Yet) :(
=======================================
This was such an interesting question to dig into. In short, we can get really, really close to accomplishing this using [Block Filters](https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/) and some hackish... |
326,894 | <p>How can change the text for "Select a category" in the product category widget?</p>
<p><a href="https://i.stack.imgur.com/DeQTo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DeQTo.png" alt="enter image description here"></a></p>
| [
{
"answer_id": 326898,
"author": "obiPlabon",
"author_id": 135737,
"author_profile": "https://wordpress.stackexchange.com/users/135737",
"pm_score": 1,
"selected": false,
"text": "<p>Use the following code snippet, hope it'll work for you. I've tested it on my dev machine and it works ju... | 2019/01/28 | [
"https://wordpress.stackexchange.com/questions/326894",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/135085/"
] | How can change the text for "Select a category" in the product category widget?
[](https://i.stack.imgur.com/DeQTo.png) | ```
function _category_dropdown_filter( $cat_args ) {
$cat_args['show_option_none'] = __('My Category');
return $cat_args;
}
add_filter( 'widget_categories_dropdown_args', '_category_dropdown_filter' );
``` |
326,900 | <p>My website is running on WordPress version <code>4.9.8</code>.</p>
<p>When I go to <code><mysite>/wp-admin/update-core.php</code>, it says,</p>
<blockquote>
<p>You have the latest version of WordPress. Future security updates will
be applied automatically.</p>
</blockquote>
<p><strong>I want to upgrade ... | [
{
"answer_id": 326898,
"author": "obiPlabon",
"author_id": 135737,
"author_profile": "https://wordpress.stackexchange.com/users/135737",
"pm_score": 1,
"selected": false,
"text": "<p>Use the following code snippet, hope it'll work for you. I've tested it on my dev machine and it works ju... | 2019/01/28 | [
"https://wordpress.stackexchange.com/questions/326900",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160014/"
] | My website is running on WordPress version `4.9.8`.
When I go to `<mysite>/wp-admin/update-core.php`, it says,
>
> You have the latest version of WordPress. Future security updates will
> be applied automatically.
>
>
>
**I want to upgrade my site to version 5.0.x**
How can I do that? | ```
function _category_dropdown_filter( $cat_args ) {
$cat_args['show_option_none'] = __('My Category');
return $cat_args;
}
add_filter( 'widget_categories_dropdown_args', '_category_dropdown_filter' );
``` |
326,931 | <p>I have created a post type and a taxonomy for this post type .</p>
<p>After I create a page to display all taxonomies for the post type.</p>
<p>When i'm click on one of the taxonomy displayed I would like to show all post type linked to this taxonomy .</p>
<p>Actually my loop is:</p>
<pre><code>$last_post = new ... | [
{
"answer_id": 326933,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p>You shouldn't need to use a custom query for this. Just link to the term's existing archive page which ... | 2019/01/28 | [
"https://wordpress.stackexchange.com/questions/326931",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160037/"
] | I have created a post type and a taxonomy for this post type .
After I create a page to display all taxonomies for the post type.
When i'm click on one of the taxonomy displayed I would like to show all post type linked to this taxonomy .
Actually my loop is:
```
$last_post = new WP_Query( array(
'post_type' =>... | You shouldn't need to use a custom query for this. Just link to the term's existing archive page which will automatically list all posts in that term. You can do this using [`get_term_link()`](https://developer.wordpress.org/reference/functions/get_term_link/). For example, this displays the URLs for each term in the t... |
326,943 | <p>This is something I have never tried so far. On a webspace I want to have a subdirectory like this:</p>
<blockquote>
<p>blognetwork.example.com</p>
</blockquote>
<p>Then I want to run Multisite with subdirectories like this:</p>
<pre><code>blognetwork.example.com/blog/
blognetwork.example.com/site1/
blognetwork... | [
{
"answer_id": 326944,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, it is.</p>\n\n<p>All you need to do is to install your WordPress on the subdomain, turn the Multi... | 2019/01/28 | [
"https://wordpress.stackexchange.com/questions/326943",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12035/"
] | This is something I have never tried so far. On a webspace I want to have a subdirectory like this:
>
> blognetwork.example.com
>
>
>
Then I want to run Multisite with subdirectories like this:
```
blognetwork.example.com/blog/
blognetwork.example.com/site1/
blognetwork.example.com/site2/
```
Is this possible ... | Yes, it is.
All you need to do is to install your WordPress on the subdomain, turn the Multisite on and set it to use subdirectories for sites.
Make sure the following is set in multisite constants:
```
define( 'SUBDOMAIN_INSTALL', false );
``` |
326,959 | <p>I'm writing a function to allow only some custom blocks - essentially I want to register all the blocks, then based on a database table of 'selected' blocks disallow any other custom block. </p>
<p>I can use <code>allowed_block_types</code> to make an array of allowed blocks, but it wipes all the core ones, is ther... | [
{
"answer_id": 326963,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 4,
"selected": true,
"text": "<p>AFAIK there is only one way to remove blocks from Gutenberg - you have to use <code>allowed_block_type... | 2019/01/28 | [
"https://wordpress.stackexchange.com/questions/326959",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/49852/"
] | I'm writing a function to allow only some custom blocks - essentially I want to register all the blocks, then based on a database table of 'selected' blocks disallow any other custom block.
I can use `allowed_block_types` to make an array of allowed blocks, but it wipes all the core ones, is there a way to either get... | AFAIK there is only one way to remove blocks from Gutenberg - you have to use `allowed_block_types` filter.
Unfortunately Gutenberg developers are not very familiar with WordPress hooks and filters, so they created a little monster with this one. So instead of passing a list of core blocks in there, they pass `true` t... |
326,974 | <p>I am using the following code for displaying a custom attribute on the Woocommerce shop page. But for some reason, the year is displayed above the product image instead of after the product title (In between the product title and the price). </p>
<pre><code>add_action('woocommerce_after_shop_loop_item_title', 'Year... | [
{
"answer_id": 326989,
"author": "Zeshan",
"author_id": 50543,
"author_profile": "https://wordpress.stackexchange.com/users/50543",
"pm_score": 0,
"selected": false,
"text": "<pre><code>add_action('woocommerce_after_shop_loop_item_title', 'YearOfMake', 15);\nfunction YearOfMake()\n{\n ... | 2019/01/28 | [
"https://wordpress.stackexchange.com/questions/326974",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/145088/"
] | I am using the following code for displaying a custom attribute on the Woocommerce shop page. But for some reason, the year is displayed above the product image instead of after the product title (In between the product title and the price).
```
add_action('woocommerce_after_shop_loop_item_title', 'YearOfMake', 10);
... | ```
add_filter( 'the_title', 'YearOfMake', 10, 2 );
function YearOfMake( $title, $post_id )
{
if ( get_post_type( $post_id ) != 'product' && ! is_archive() )
return $title;
if ( ! ( is_shop() || is_product_category() || is_product_tag() ) )
return $title;
/*
global $product;
... |
326,983 | <p>I'm trying to learn how to create blocks for the block editor. I can't seem to find a list of form elements to add. For example, I need a toggle switch, dropdown, etc.</p>
<p>I found <a href="https://github.com/WordPress/gutenberg/tree/master/packages/components/src/toggle-control" rel="nofollow noreferrer">THIS ... | [
{
"answer_id": 326984,
"author": "Alvaro",
"author_id": 16533,
"author_profile": "https://wordpress.stackexchange.com/users/16533",
"pm_score": 2,
"selected": false,
"text": "<p>There are two main packages that provide components which can be used inside the <a href=\"https://github.com/... | 2019/01/29 | [
"https://wordpress.stackexchange.com/questions/326983",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157172/"
] | I'm trying to learn how to create blocks for the block editor. I can't seem to find a list of form elements to add. For example, I need a toggle switch, dropdown, etc.
I found [THIS toggle](https://github.com/WordPress/gutenberg/tree/master/packages/components/src/toggle-control), but I'm not sure how to use it and ca... | There are two main packages that provide components which can be used inside the [blocks API](https://github.com/WordPress/gutenberg/tree/master/packages/blocks) or the [plugins API](https://github.com/WordPress/gutenberg/tree/master/packages/blocks) (to create your own blocks or plugins).
The components found in the ... |
327,080 | <p>is it possible to alternate between two homepages in Wordpress without messing up SEO or anything unforeseen? We want to create Home-old and Home-new for A/B testing purposes. </p>
<p>Thank you!</p>
| [
{
"answer_id": 327083,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 0,
"selected": false,
"text": "<p>It depends on what and how you are making these changes. </p>\n\n<p>If you are changing the HTML, chang... | 2019/01/30 | [
"https://wordpress.stackexchange.com/questions/327080",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160138/"
] | is it possible to alternate between two homepages in Wordpress without messing up SEO or anything unforeseen? We want to create Home-old and Home-new for A/B testing purposes.
Thank you! | Your question seems to conflict itself - you want to run A/B testing, but don't want to mess up your SEO? The point of running A/B testing is to compare which page performs better, so naturally there will be a difference in how each page performs - hopefully your new page variation performs better (which is why you cre... |
327,090 | <p>Second level of my navigation menu (drop-down) doesn't seem to be working.</p>
<p>Things to note:</p>
<ul>
<li>It's not loading into the site (i.e. not showing in source code <em>image below</em>)</li>
<li>I'm using bootstrap 4 for the layout of my theme (the menu is not bootstrap however)</li>
<li>I'm trying to g... | [
{
"answer_id": 327083,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 0,
"selected": false,
"text": "<p>It depends on what and how you are making these changes. </p>\n\n<p>If you are changing the HTML, chang... | 2019/01/30 | [
"https://wordpress.stackexchange.com/questions/327090",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159903/"
] | Second level of my navigation menu (drop-down) doesn't seem to be working.
Things to note:
* It's not loading into the site (i.e. not showing in source code *image below*)
* I'm using bootstrap 4 for the layout of my theme (the menu is not bootstrap however)
* I'm trying to get prouct categories in dropdown, though o... | Your question seems to conflict itself - you want to run A/B testing, but don't want to mess up your SEO? The point of running A/B testing is to compare which page performs better, so naturally there will be a difference in how each page performs - hopefully your new page variation performs better (which is why you cre... |
327,104 | <p>I created a custom shortcode from my child theme's functions.php, And I want that shortcode to display in Post Category Description. But it's not working. </p>
<p>Do you guys have an idea on how to enable display of shortcodes in post category description?</p>
<p><a href="https://i.stack.imgur.com/kNnTQ.png" rel="... | [
{
"answer_id": 327106,
"author": "Chinmoy Kumar Paul",
"author_id": 57436,
"author_profile": "https://wordpress.stackexchange.com/users/57436",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure what kind of code is using in your theme. I am sharing the code for idea.</p>\n\n<pr... | 2019/01/30 | [
"https://wordpress.stackexchange.com/questions/327104",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/115131/"
] | I created a custom shortcode from my child theme's functions.php, And I want that shortcode to display in Post Category Description. But it's not working.
Do you guys have an idea on how to enable display of shortcodes in post category description?
[;
add_filter( 'term_description', 'do_shortcode' );
remove_filter( 'pre_term_description', 'wp_filter_kses' );
```
I just added those line of codes into the Child theme's function.php.
Thanks to this post: [How to get a ... |
327,130 | <p>I'm trying to do a single WP_Query to get the posts that are in 2 different custom post types but the second post type has to be from a specific taxonomy.</p>
<p>This is what I'm currently doing:</p>
<pre><code> $query1 = new WP_Query(array(
'numberposts' => $postsnumber,
'posts_per_page' =&g... | [
{
"answer_id": 327106,
"author": "Chinmoy Kumar Paul",
"author_id": 57436,
"author_profile": "https://wordpress.stackexchange.com/users/57436",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure what kind of code is using in your theme. I am sharing the code for idea.</p>\n\n<pr... | 2019/01/30 | [
"https://wordpress.stackexchange.com/questions/327130",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8289/"
] | I'm trying to do a single WP\_Query to get the posts that are in 2 different custom post types but the second post type has to be from a specific taxonomy.
This is what I'm currently doing:
```
$query1 = new WP_Query(array(
'numberposts' => $postsnumber,
'posts_per_page' => $postsnumber,
'orde... | I found the answer to my own question.
```
add_filter( 'term_description', 'shortcode_unautop' );
add_filter( 'term_description', 'do_shortcode' );
remove_filter( 'pre_term_description', 'wp_filter_kses' );
```
I just added those line of codes into the Child theme's function.php.
Thanks to this post: [How to get a ... |
327,138 | <p>Complete Code.</p>
<p>
<pre><code>// Set UI labels for Custom Post Type
$labels = array(
'name' => _x( 'Events', 'evn_calendar'),
'singular_name' => _x( 'events', 'evn_calendar'),
'menu_name' => __( 'Events', 'evn_calendar' ),
'parent_item_colon' => __( 'Parent Event', ... | [
{
"answer_id": 327106,
"author": "Chinmoy Kumar Paul",
"author_id": 57436,
"author_profile": "https://wordpress.stackexchange.com/users/57436",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure what kind of code is using in your theme. I am sharing the code for idea.</p>\n\n<pr... | 2019/01/30 | [
"https://wordpress.stackexchange.com/questions/327138",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/83079/"
] | Complete Code.
```
// Set UI labels for Custom Post Type
$labels = array(
'name' => _x( 'Events', 'evn_calendar'),
'singular_name' => _x( 'events', 'evn_calendar'),
'menu_name' => __( 'Events', 'evn_calendar' ),
'parent_item_colon' => __( 'Parent Event', 'evn_calendar' ),
'all_items' ... | I found the answer to my own question.
```
add_filter( 'term_description', 'shortcode_unautop' );
add_filter( 'term_description', 'do_shortcode' );
remove_filter( 'pre_term_description', 'wp_filter_kses' );
```
I just added those line of codes into the Child theme's function.php.
Thanks to this post: [How to get a ... |
327,139 | <p>Here's the situation;</p>
<p>I am using get_terms to retrieve all terms from <strong>Tax 1</strong> with posts associated with it. Using the following </p>
<pre><code>$args = array(
'hide_empty' => 0,
'orderby' => 'name',
'taxonomy' => 'tax_1'
)... | [
{
"answer_id": 327143,
"author": "Alexander Holsgrove",
"author_id": 48962,
"author_profile": "https://wordpress.stackexchange.com/users/48962",
"pm_score": 2,
"selected": false,
"text": "<p>You could use the tax_query argument, for example:</p>\n\n<pre><code>'tax_query' => array(\n ... | 2019/01/30 | [
"https://wordpress.stackexchange.com/questions/327139",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103782/"
] | Here's the situation;
I am using get\_terms to retrieve all terms from **Tax 1** with posts associated with it. Using the following
```
$args = array(
'hide_empty' => 0,
'orderby' => 'name',
'taxonomy' => 'tax_1'
);
$terms = get_terms( $args );
```
P... | Just to start, you say *"I am using get\_terms to retrieve all terms from Tax 1 with posts associated with it"*, however your actual code gets all terms in that taxonomy regardless of whether or not they have posts. You need to set `hide_empty` to `true`.
So with that out of the way, the bad news: You won't be able to... |
327,167 | <p>I should first mention I am fairly new to wordpress and web development.</p>
<p>I was given the task to update an existing site which includes the navigation bar. I have been digging through code trying to figure out where the actual code has been stored for the nav. The site is a custom build theme which looks to ... | [
{
"answer_id": 327176,
"author": "Karl Poppery",
"author_id": 160195,
"author_profile": "https://wordpress.stackexchange.com/users/160195",
"pm_score": -1,
"selected": false,
"text": "<p>On your Dashboard, go to appearance -> menus and add the pages you want to the menu</p>\n"
},
{
... | 2019/01/30 | [
"https://wordpress.stackexchange.com/questions/327167",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160189/"
] | I should first mention I am fairly new to wordpress and web development.
I was given the task to update an existing site which includes the navigation bar. I have been digging through code trying to figure out where the actual code has been stored for the nav. The site is a custom build theme which looks to be built u... | The first step is to make the "Shopping Nav" Active. It's currently set to "display:none" in the css, probably because the menu isn't active. Once you change display:none on that menu, then you can start positioning it to be split from the other menu at the top of the screen.
This is what needs to be changed in the C... |
327,197 | <p>I am trying to add a few meta boxes for a Custom Post Type through a Class. I am using the <code>"register_meta_box_cb"</code> parameter while registering the Custom Post Type to specify the callback function for adding meta boxes. </p>
<p>Sample code - (outline of my code) -</p>
<p>
<pre><code>class ABC
{
publ... | [
{
"answer_id": 327176,
"author": "Karl Poppery",
"author_id": 160195,
"author_profile": "https://wordpress.stackexchange.com/users/160195",
"pm_score": -1,
"selected": false,
"text": "<p>On your Dashboard, go to appearance -> menus and add the pages you want to the menu</p>\n"
},
{
... | 2019/01/31 | [
"https://wordpress.stackexchange.com/questions/327197",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/128119/"
] | I am trying to add a few meta boxes for a Custom Post Type through a Class. I am using the `"register_meta_box_cb"` parameter while registering the Custom Post Type to specify the callback function for adding meta boxes.
Sample code - (outline of my code) -
```
class ABC
{
public static function add_customposttype... | The first step is to make the "Shopping Nav" Active. It's currently set to "display:none" in the css, probably because the menu isn't active. Once you change display:none on that menu, then you can start positioning it to be split from the other menu at the top of the screen.
This is what needs to be changed in the C... |
327,210 | <p>How to translate my website into another language like <strong><em>Malayalam</em></strong>. Can You suggest something. There is a problem when I used GTranslate plugin, that is it doesn't translate correctly. There is any chance of content editing/ changing the content when translating a page? </p>
| [
{
"answer_id": 327176,
"author": "Karl Poppery",
"author_id": 160195,
"author_profile": "https://wordpress.stackexchange.com/users/160195",
"pm_score": -1,
"selected": false,
"text": "<p>On your Dashboard, go to appearance -> menus and add the pages you want to the menu</p>\n"
},
{
... | 2019/01/31 | [
"https://wordpress.stackexchange.com/questions/327210",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154128/"
] | How to translate my website into another language like ***Malayalam***. Can You suggest something. There is a problem when I used GTranslate plugin, that is it doesn't translate correctly. There is any chance of content editing/ changing the content when translating a page? | The first step is to make the "Shopping Nav" Active. It's currently set to "display:none" in the css, probably because the menu isn't active. Once you change display:none on that menu, then you can start positioning it to be split from the other menu at the top of the screen.
This is what needs to be changed in the C... |
327,221 | <p>I am updating one of my plugins for Gutenberg. I need to check for the presence of a custom post meta field when a post is updated or published, so I've hooked into <code>publish_post</code>:</p>
<pre><code>function process_meta( $ID, $post ) {
if (get_post_meta($ID, 'my_post_meta_field', true)) {
// do... | [
{
"answer_id": 327222,
"author": "Chinmoy Kumar Paul",
"author_id": 57436,
"author_profile": "https://wordpress.stackexchange.com/users/57436",
"pm_score": -1,
"selected": false,
"text": "<p>Replace <code>add_action('publish_post', 'process_meta', 10, 2);</code> with <code>add_action('sa... | 2019/01/31 | [
"https://wordpress.stackexchange.com/questions/327221",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160222/"
] | I am updating one of my plugins for Gutenberg. I need to check for the presence of a custom post meta field when a post is updated or published, so I've hooked into `publish_post`:
```
function process_meta( $ID, $post ) {
if (get_post_meta($ID, 'my_post_meta_field', true)) {
// do something
}
}
add_ac... | The solution is to use a different hook which fires after post meta data has been saved by Gutenberg to the WP API. After reading [this related discussion](https://github.com/WordPress/gutenberg/issues/12903) on Github and inspecting [this code by n7studios](https://gist.github.com/n7studios/56fd05f19f5da26f19f6da0ccb5... |
327,233 | <p>I am going to find a way for logged in users to create pages from front page. For example there are three buttons so called button1,2,3. When logged in users clicks on button1, a page with title newyork1 is created and if user clicks on New York button for one more time, a new page newyork1-1 and newyork1-2 are crea... | [
{
"answer_id": 327222,
"author": "Chinmoy Kumar Paul",
"author_id": 57436,
"author_profile": "https://wordpress.stackexchange.com/users/57436",
"pm_score": -1,
"selected": false,
"text": "<p>Replace <code>add_action('publish_post', 'process_meta', 10, 2);</code> with <code>add_action('sa... | 2019/01/31 | [
"https://wordpress.stackexchange.com/questions/327233",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159012/"
] | I am going to find a way for logged in users to create pages from front page. For example there are three buttons so called button1,2,3. When logged in users clicks on button1, a page with title newyork1 is created and if user clicks on New York button for one more time, a new page newyork1-1 and newyork1-2 are created... | The solution is to use a different hook which fires after post meta data has been saved by Gutenberg to the WP API. After reading [this related discussion](https://github.com/WordPress/gutenberg/issues/12903) on Github and inspecting [this code by n7studios](https://gist.github.com/n7studios/56fd05f19f5da26f19f6da0ccb5... |
327,284 | <p>I have home page with a main slider and news section.</p>
<ul>
<li>Main slider</li>
<li>Sport section news</li>
<li>Economy section news</li>
<li>Politic section news </li>
<li>and others section </li>
</ul>
<p>The main slider get posts by tag ='slider', and display 10 posts limit.</p>
<p>The sections get posts b... | [
{
"answer_id": 327270,
"author": "Sabbir Hasan",
"author_id": 76587,
"author_profile": "https://wordpress.stackexchange.com/users/76587",
"pm_score": 0,
"selected": false,
"text": "<p>You have to do two things</p>\n\n<ol>\n<li>Completely disable visual editor</li>\n<li>enable Markdown. <... | 2019/01/31 | [
"https://wordpress.stackexchange.com/questions/327284",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158072/"
] | I have home page with a main slider and news section.
* Main slider
* Sport section news
* Economy section news
* Politic section news
* and others section
The main slider get posts by tag ='slider', and display 10 posts limit.
The sections get posts by category (each section by specific category)
What i wold like... | You can try `remove_filter( 'the_content', 'wpautop' );` to remove the added HTML tags.
<https://codex.wordpress.org/Function_Reference/wpautop> |
327,296 | <p>I am trying to understand how to add a class to a set of images in WordPress. Specifically I am trying to add a class, for example, <code>.no-lazy-load</code>, to exclude those images from being lazy loaded via the <a href="https://wordpress.org/plugins/a3-lazy-load/" rel="nofollow noreferrer">a3 Lazy Load plugin</... | [
{
"answer_id": 327525,
"author": "Sabbir Hasan",
"author_id": 76587,
"author_profile": "https://wordpress.stackexchange.com/users/76587",
"pm_score": 0,
"selected": false,
"text": "<p>You can use jQuery to add remove classes on user browser. Approach can be something like this:</p>\n\n<p... | 2019/01/31 | [
"https://wordpress.stackexchange.com/questions/327296",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/152391/"
] | I am trying to understand how to add a class to a set of images in WordPress. Specifically I am trying to add a class, for example, `.no-lazy-load`, to exclude those images from being lazy loaded via the [a3 Lazy Load plugin](https://wordpress.org/plugins/a3-lazy-load/). The set is a series of 6 images within a Slick s... | You can use the [get\_image\_tag\_class](https://developer.wordpress.org/reference/hooks/get_image_tag_class/) filter which passes the attachment ID as an argument:
```
apply_filters('get_image_tag_class', string $class, int $id, string $align, string|array $size)
```
So you can use:
```
function my_image_tag_class... |
327,334 | <p>I have a (weird) issue - can't get the ACF field to work on my page. I have a simple <code>text_field</code> and it shows on the <code>Homepage</code> page section:</p>
<p>ACF settings:
<a href="https://i.stack.imgur.com/4pRMz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4pRMz.png" alt="enter ... | [
{
"answer_id": 327336,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 3,
"selected": true,
"text": "<p><code>the_field()</code> function shows the value and it doesn't get/return anything. Like <code>the_t... | 2019/02/01 | [
"https://wordpress.stackexchange.com/questions/327334",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/59688/"
] | I have a (weird) issue - can't get the ACF field to work on my page. I have a simple `text_field` and it shows on the `Homepage` page section:
ACF settings:
[](https://i.stack.imgur.com/4pRMz.png)
---
Homepage settings (when I refresh the panel it s... | `the_field()` function shows the value and it doesn't get/return anything. Like `the_title()` and other template tags starting with `the_`.
It means that:
This line prints the value and `$hero` variable is empty.
```
$hero = the_field('hero_title');
```
This line prints only `<h1>` tags.
```
echo '<h1>'.$hero.'</... |
327,361 | <p>i have a problem with my woocommerce, I cant remove the page title in the product on desktop view. Anyone know what can i do ? thank you very much</p>
<p>store <a href="https://kingsport.ro" rel="nofollow noreferrer">https://kingsport.ro</a></p>
<p><a href="https://i.stack.imgur.com/KQNy6.png" rel="nofollow norefe... | [
{
"answer_id": 327363,
"author": "Manoj Patel",
"author_id": 158186,
"author_profile": "https://wordpress.stackexchange.com/users/158186",
"pm_score": 0,
"selected": false,
"text": "<p>You can use below css to remove the title on desktop view through the media query</p>\n\n<pre><code>.po... | 2019/02/01 | [
"https://wordpress.stackexchange.com/questions/327361",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160326/"
] | i have a problem with my woocommerce, I cant remove the page title in the product on desktop view. Anyone know what can i do ? thank you very much
store <https://kingsport.ro>
[](https://i.stack.imgur.com/KQNy6.png) | Write the CSS into style.css file
```
@media only screen and (min-width: 768px) {
.single-product .title-desc {
display: none;
}
}
```
`.single-product` CSS will only work on single product details. It will not create any issue on other pages. |
327,365 | <p>Hey guys so I'm trying to enqueue a javascript with filemtime but every time I do it the custom js script I wrote doesn't seem to enqueue.</p>
<pre><code>function add_js_scripts(){
wp_register_script('lib',
get_template_directory_uri().'/js/lib.js',
array(),
filemtime(get_template_directory()... | [
{
"answer_id": 327366,
"author": "Chinmoy Kumar Paul",
"author_id": 57436,
"author_profile": "https://wordpress.stackexchange.com/users/57436",
"pm_score": 2,
"selected": false,
"text": "<p><strong>wp_register_script()</strong> function is accepting the 5 parameters. You are passing the ... | 2019/02/01 | [
"https://wordpress.stackexchange.com/questions/327365",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/93537/"
] | Hey guys so I'm trying to enqueue a javascript with filemtime but every time I do it the custom js script I wrote doesn't seem to enqueue.
```
function add_js_scripts(){
wp_register_script('lib',
get_template_directory_uri().'/js/lib.js',
array(),
filemtime(get_template_directory() . '/js/lib.js... | So it seems that sometimes for some reason certain scripts dont seem to enqueue when you register the script then enqueue it when using filemtime in the parameter:
```
function add_js_scripts(){
wp_register_script('lib',
get_template_directory_uri().'/js/lib.js',
array(),
filemtime(get_template_directory() . '/js/lib... |
327,384 | <p>I've created a theme that includes a custom dashboard outside of wp-admin. </p>
<p>I would like a user who doesn't have access to the wp-admin (but does have access to my custom dashboard) to be able to receive an update notification for their theme.</p>
<p>If that's impossible, I could also work with the user jus... | [
{
"answer_id": 327366,
"author": "Chinmoy Kumar Paul",
"author_id": 57436,
"author_profile": "https://wordpress.stackexchange.com/users/57436",
"pm_score": 2,
"selected": false,
"text": "<p><strong>wp_register_script()</strong> function is accepting the 5 parameters. You are passing the ... | 2019/02/01 | [
"https://wordpress.stackexchange.com/questions/327384",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160341/"
] | I've created a theme that includes a custom dashboard outside of wp-admin.
I would like a user who doesn't have access to the wp-admin (but does have access to my custom dashboard) to be able to receive an update notification for their theme.
If that's impossible, I could also work with the user just receiving the u... | So it seems that sometimes for some reason certain scripts dont seem to enqueue when you register the script then enqueue it when using filemtime in the parameter:
```
function add_js_scripts(){
wp_register_script('lib',
get_template_directory_uri().'/js/lib.js',
array(),
filemtime(get_template_directory() . '/js/lib... |
327,395 | <p>I've seen this solution for querying pages based off of template type: <a href="https://wordpress.stackexchange.com/questions/29918/page-template-query-with-wp-query">Page template query with WP_Query</a></p>
<p>I'm having trouble getting it to work with posts, that are using a "Single Post Template:" rather than a... | [
{
"answer_id": 327366,
"author": "Chinmoy Kumar Paul",
"author_id": 57436,
"author_profile": "https://wordpress.stackexchange.com/users/57436",
"pm_score": 2,
"selected": false,
"text": "<p><strong>wp_register_script()</strong> function is accepting the 5 parameters. You are passing the ... | 2019/02/01 | [
"https://wordpress.stackexchange.com/questions/327395",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160347/"
] | I've seen this solution for querying pages based off of template type: [Page template query with WP\_Query](https://wordpress.stackexchange.com/questions/29918/page-template-query-with-wp-query)
I'm having trouble getting it to work with posts, that are using a "Single Post Template:" rather than a "Template Name:" de... | So it seems that sometimes for some reason certain scripts dont seem to enqueue when you register the script then enqueue it when using filemtime in the parameter:
```
function add_js_scripts(){
wp_register_script('lib',
get_template_directory_uri().'/js/lib.js',
array(),
filemtime(get_template_directory() . '/js/lib... |
327,396 | <p>I want to set the <em>default</em> target of the image block in Gutenberg to "Media File":</p>
<p><a href="https://i.stack.imgur.com/thhKx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/thhKx.png" alt="Link target"></a></p>
<p>I've found solutions for the <a href="https://wordpress.stackexchang... | [
{
"answer_id": 327400,
"author": "Alvaro",
"author_id": 16533,
"author_profile": "https://wordpress.stackexchange.com/users/16533",
"pm_score": 2,
"selected": false,
"text": "<p>Using the filter <code>blocks.registerBlockType</code> we can alter block registration settings. We simply nee... | 2019/02/01 | [
"https://wordpress.stackexchange.com/questions/327396",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/138112/"
] | I want to set the *default* target of the image block in Gutenberg to "Media File":
[](https://i.stack.imgur.com/thhKx.png)
I've found solutions for the [classic editor](https://wordpress.stackexchange.com/questions/251429/set-default-options-for-inserting-media), an... | This was (finally) fixed to Gutenberg (and will be applicable for both the image and the gallery blocks); and will add an option to WordPress options' database table.
this was done in
<https://github.com/WordPress/gutenberg/pull/25578> and <https://github.com/WordPress/gutenberg/pull/25582>
It'll be added to WordPress... |
327,403 | <p>I'm using my featured image as a background image on a div and I would like to add a second background-image to that same div on hover (I need them both because I want to blend them). Any suggestions?</p>
<p>I was able to achieve that using regular html and css, but now that I'm using the featured image as the back... | [
{
"answer_id": 327405,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 0,
"selected": false,
"text": "<p>If you want something to happen when you 'hover', you can do that with some CSS. Assign a id (since th... | 2019/02/02 | [
"https://wordpress.stackexchange.com/questions/327403",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160353/"
] | I'm using my featured image as a background image on a div and I would like to add a second background-image to that same div on hover (I need them both because I want to blend them). Any suggestions?
I was able to achieve that using regular html and css, but now that I'm using the featured image as the background, I ... | Use a single element, with a pseudo element (:before) for the featured image, and appropriate hover styling to set its opacity and reveal a blend with the underlying second image. I threw in a gradual image transition just to make it look a little nicer.
**html:**
```
<div class="my-image-holder">
text and other ... |
327,416 | <p>I'm working on a site for a school and the teachers all want to post the homework for their students online, but only so each student can see his or her own class's homework posted by their teacher.</p>
<p>What i want to do is basically this: </p>
<ul>
<li>get user role</li>
<li>if user role = rolename1, display p... | [
{
"answer_id": 327428,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": 0,
"selected": false,
"text": "<p>You can try using <a href=\"https://wordpress.org/plugins/wp-private-content-plus/\" rel=\"no... | 2019/02/02 | [
"https://wordpress.stackexchange.com/questions/327416",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37676/"
] | I'm working on a site for a school and the teachers all want to post the homework for their students online, but only so each student can see his or her own class's homework posted by their teacher.
What i want to do is basically this:
* get user role
* if user role = rolename1, display posts by category 1, hide all... | The problem consists of three parts: getting the current user data, linking that to a category and retrieving and displaying the posts. You can include these snippets on a custom page template, which you assign to the 'My homework'-page.
Below these three sub-answers, I share some additional suggestions on ways of ma... |
327,424 | <p>The links in the navbar menu, in (My sites > Manage the network) are pointing (and keep redirecting) to incorrect URLs.</p>
<p>The incorrect URLs are in this pattern:</p>
<pre><code>https://https//www.domain.com/wp-admin/network/
https://https//www.domain.com/wp-admin/network/sites.php
https://https//www.domain.co... | [
{
"answer_id": 327425,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": 0,
"selected": false,
"text": "<p>Have you checked <strong>wp_blogs</strong>? Is it OK?</p>\n\n<p>Also, make sure that all the ... | 2019/02/02 | [
"https://wordpress.stackexchange.com/questions/327424",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101507/"
] | The links in the navbar menu, in (My sites > Manage the network) are pointing (and keep redirecting) to incorrect URLs.
The incorrect URLs are in this pattern:
```
https://https//www.domain.com/wp-admin/network/
https://https//www.domain.com/wp-admin/network/sites.php
https://https//www.domain.com/wp-admin/network/se... | There are 5 values need to change.
From database.
```
wp_options: options named “siteurl” and “home”
wp_site
wp_sitemeta: the option named “siteurl”
wp_blogs: any entries in the “domains” column that have the old domain name
wp_#_options: Each sub-site will have sets of tables that correspond to the blog_id in th... |
327,447 | <p>I have a taxonomy called <code>coupon_category</code>. In a <code>query_post</code> I am trying to call all posts from related custom taxonomy with the same <code>coupon_category</code>.</p>
<p>If I use:</p>
<pre><code><?php
// show all active coupons for this category from related store an... | [
{
"answer_id": 327455,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>You'll have to get the terms of current post with <code>get_the_terms</code> function and then use th... | 2019/02/02 | [
"https://wordpress.stackexchange.com/questions/327447",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153850/"
] | I have a taxonomy called `coupon_category`. In a `query_post` I am trying to call all posts from related custom taxonomy with the same `coupon_category`.
If I use:
```
<?php
// show all active coupons for this category from related store and setup pagination
$paged = (get_que... | Okay after a lot of reading I finally changed to 'wp\_query' and this is the perfect solution:
```
$tax = get_the_terms($id, 'coupon_category');
$args = array(
'post_type' => APP_POST_TYPE,
'post_status' => 'publish',
'posts_pe... |
327,465 | <p>I have this code:</p>
<pre><code>query_posts( array(
'post_type' => APP_POST_TYPE,
'post_status' => 'publish',
'posts_per_page' => 4,
),
) );
</code></pre>
<p>now I nee... | [
{
"answer_id": 327495,
"author": "phatskat",
"author_id": 20143,
"author_profile": "https://wordpress.stackexchange.com/users/20143",
"pm_score": 1,
"selected": false,
"text": "<p>The easiest way I can see is to gather a list of the terms in that taxonomy, and use them with a <code>NOT I... | 2019/02/02 | [
"https://wordpress.stackexchange.com/questions/327465",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153850/"
] | I have this code:
```
query_posts( array(
'post_type' => APP_POST_TYPE,
'post_status' => 'publish',
'posts_per_page' => 4,
),
) );
```
now I need to remove all post from this Quer... | Okay found a solution that's working as well:
```
query_posts( array(
'post_type' => APP_POST_TYPE,
'post_status' => 'publish',
'posts_per_page' => 4,
'tax_query' => array(
array(
'taxonomy' => APP_TAX_STORE,
'field' => 'slug',
'terms' => $term->slug,
'operator' =... |
327,469 | <p>I'm building a custom child theme using the <a href="https://wordpress.org/themes/twentynineteen/" rel="nofollow noreferrer">Twenty Nineteen</a> default WordPress theme as the parent.</p>
<p>I added some text in the excerpt section available in the Editor as follows:</p>
<p><a href="https://i.stack.imgur.com/pB1ao... | [
{
"answer_id": 327475,
"author": "Arturo Gallegos",
"author_id": 130585,
"author_profile": "https://wordpress.stackexchange.com/users/130585",
"pm_score": 0,
"selected": false,
"text": "<p>you need modify your template, in your PHP change <code>the_content()</code> to <code>the_excerpt(... | 2019/02/02 | [
"https://wordpress.stackexchange.com/questions/327469",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/74607/"
] | I'm building a custom child theme using the [Twenty Nineteen](https://wordpress.org/themes/twentynineteen/) default WordPress theme as the parent.
I added some text in the excerpt section available in the Editor as follows:
[](https://i.stack.imgur.c... | You should use a custom page for this. For reference, we can modify the default (twentynineteen) post content block. Depending on your theme, you may need to modify `single.php`, or a content block included from there. In the `twentynineteen` theme, we can see this on line `24`:
```php
get_template_part( 'template-par... |
327,491 | <p>We are looking for a way to add Advanced Custom Fields data to a user / subscriber after they have purchased a product (Woocommerce). The subscriber should be able to edit these fields on the frontend and save to their own account. We have been using Buddypress's XProfile fields to handle this but isn't ideal for wh... | [
{
"answer_id": 327879,
"author": "Anton Shinkarenko",
"author_id": 160690,
"author_profile": "https://wordpress.stackexchange.com/users/160690",
"pm_score": 0,
"selected": false,
"text": "<p>You can use ACF on the frontend in similar way</p>\n\n<pre><code>$user_id = 'user_' . $user->I... | 2019/02/03 | [
"https://wordpress.stackexchange.com/questions/327491",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58254/"
] | We are looking for a way to add Advanced Custom Fields data to a user / subscriber after they have purchased a product (Woocommerce). The subscriber should be able to edit these fields on the frontend and save to their own account. We have been using Buddypress's XProfile fields to handle this but isn't ideal for what ... | ACF has a built in way to do this. Its [acf\_form()](https://www.advancedcustomfields.com/resources/acf_form/). Essentially it lets you build a form on the frontend that will update your custom fields.
Here is a basic example from their site. Note the use of [acf\_form\_head()](https://www.advancedcustomfields.com/res... |
327,515 | <p>I have been searching at this site posts about blogs being hacker, but I haven't find something like this.</p>
<p>One of our Editor's account has started to publish random posts. Our first thought was his password being stolen, so we changed it and we told him not to log in for a certain time. Random posts appeared... | [
{
"answer_id": 327879,
"author": "Anton Shinkarenko",
"author_id": 160690,
"author_profile": "https://wordpress.stackexchange.com/users/160690",
"pm_score": 0,
"selected": false,
"text": "<p>You can use ACF on the frontend in similar way</p>\n\n<pre><code>$user_id = 'user_' . $user->I... | 2019/02/03 | [
"https://wordpress.stackexchange.com/questions/327515",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160396/"
] | I have been searching at this site posts about blogs being hacker, but I haven't find something like this.
One of our Editor's account has started to publish random posts. Our first thought was his password being stolen, so we changed it and we told him not to log in for a certain time. Random posts appeared again at ... | ACF has a built in way to do this. Its [acf\_form()](https://www.advancedcustomfields.com/resources/acf_form/). Essentially it lets you build a form on the frontend that will update your custom fields.
Here is a basic example from their site. Note the use of [acf\_form\_head()](https://www.advancedcustomfields.com/res... |
327,520 | <p>I created a custom post type and I am trying to get the posts from it using WP-API, however, when I try to access the API I get the error rest_no_route message.
The set up for my custom post type is below:</p>
<pre><code>function cw_post_type_pil() {
$supports = array('title', //
post title'editor', // post conte... | [
{
"answer_id": 327879,
"author": "Anton Shinkarenko",
"author_id": 160690,
"author_profile": "https://wordpress.stackexchange.com/users/160690",
"pm_score": 0,
"selected": false,
"text": "<p>You can use ACF on the frontend in similar way</p>\n\n<pre><code>$user_id = 'user_' . $user->I... | 2019/02/03 | [
"https://wordpress.stackexchange.com/questions/327520",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160421/"
] | I created a custom post type and I am trying to get the posts from it using WP-API, however, when I try to access the API I get the error rest\_no\_route message.
The set up for my custom post type is below:
```
function cw_post_type_pil() {
$supports = array('title', //
post title'editor', // post content
'author'... | ACF has a built in way to do this. Its [acf\_form()](https://www.advancedcustomfields.com/resources/acf_form/). Essentially it lets you build a form on the frontend that will update your custom fields.
Here is a basic example from their site. Note the use of [acf\_form\_head()](https://www.advancedcustomfields.com/res... |
327,534 | <p>I need some help, again.</p>
<p>I use this query:</p>
<pre><code>$tax = get_the_terms($id, 'coupon_category');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( array(
'post_type' => APP_POST_TYPE,
... | [
{
"answer_id": 327543,
"author": "Mohsin Ghouri",
"author_id": 159253,
"author_profile": "https://wordpress.stackexchange.com/users/159253",
"pm_score": 0,
"selected": false,
"text": "<p>You can't get the only one post of each taxonomy in a single query. You have to get the single post b... | 2019/02/03 | [
"https://wordpress.stackexchange.com/questions/327534",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153850/"
] | I need some help, again.
I use this query:
```
$tax = get_the_terms($id, 'coupon_category');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( array(
'post_type' => APP_POST_TYPE,
'post_status' => 'publi... | Yeah sure.
```
<?php
$included_post_ids =array();
$args = array(
'post_type' => 'APP_POST_TYPE',
'post_status' => 'publish',
'posts_per_page' => 1,
'tax_query' => array(
... |
327,535 | <p>I want to give the user the ability to order posts by post date/alphabetically either on ASC or DESC order through a <code>select</code> input on an archive page.</p>
<p>The easy way would be to show two inputs on the front end: one controlling the <code>order_by</code> parameter, and other controlling the <code>or... | [
{
"answer_id": 327543,
"author": "Mohsin Ghouri",
"author_id": 159253,
"author_profile": "https://wordpress.stackexchange.com/users/159253",
"pm_score": 0,
"selected": false,
"text": "<p>You can't get the only one post of each taxonomy in a single query. You have to get the single post b... | 2019/02/03 | [
"https://wordpress.stackexchange.com/questions/327535",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/136994/"
] | I want to give the user the ability to order posts by post date/alphabetically either on ASC or DESC order through a `select` input on an archive page.
The easy way would be to show two inputs on the front end: one controlling the `order_by` parameter, and other controlling the `order` parameter.
But it would be a lo... | Yeah sure.
```
<?php
$included_post_ids =array();
$args = array(
'post_type' => 'APP_POST_TYPE',
'post_status' => 'publish',
'posts_per_page' => 1,
'tax_query' => array(
... |
327,538 | <p><a href="https://i.stack.imgur.com/yN5Q4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yN5Q4.png" alt="enter image description here"></a></p>
<p>How can I add custom metabox in document tab in gutenberg?</p>
<p>There is documentation about adding plugin sidebar <a href="https://wordpress.org/gutenberg/... | [
{
"answer_id": 330417,
"author": "Spanners",
"author_id": 162325,
"author_profile": "https://wordpress.stackexchange.com/users/162325",
"pm_score": 3,
"selected": false,
"text": "<p>I took a look at <a href=\"https://richardtape.com/2018/10/05/add-a-custom-sidebar-panel-to-gutenberg/\" r... | 2019/02/03 | [
"https://wordpress.stackexchange.com/questions/327538",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/51280/"
] | [](https://i.stack.imgur.com/yN5Q4.png)
How can I add custom metabox in document tab in gutenberg?
There is documentation about adding plugin sidebar [here](https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/plugin-sid... | Here is the solution. Hope it will help you
```
const { registerPlugin } = wp.plugins;
const { PluginDocumentSettingPanel } = wp.editPost;
const MyDocumentSettingTest = () => (
<PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel">
<p>My Document Setting Panel</p... |
327,550 | <p>I added a taxonomy and custom post type, but for some reason, my taxonomy isn't showing up when I add a new marker. I half expected it to be there like when selecting a category for a post, but it isn't. Any ideas what the issue might be? </p>
<pre><code>function register_mm_post_types()
{
register_taxonomy('ma... | [
{
"answer_id": 327556,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 6,
"selected": true,
"text": "<p>The Gutenberg editor relies on the REST API, so both post types and taxonomies require the <code>show_in_rest</code... | 2019/02/03 | [
"https://wordpress.stackexchange.com/questions/327550",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9243/"
] | I added a taxonomy and custom post type, but for some reason, my taxonomy isn't showing up when I add a new marker. I half expected it to be there like when selecting a category for a post, but it isn't. Any ideas what the issue might be?
```
function register_mm_post_types()
{
register_taxonomy('marker_types',
... | The Gutenberg editor relies on the REST API, so both post types and taxonomies require the `show_in_rest` parameter be set to `true` when registering them. Your post type has this, but it's missing from your taxonomy. |
327,554 | <p>So I recently, built and LAMP server and installed wordpress on it. I connected it to the web via a reverse ssh tunnel using serveo.net. I decided to add ssl and the rest of the website seem to work fine, but wordpress keeps breaking when I try to use ssl. I went to the general settings and changed the urls to http ... | [
{
"answer_id": 327562,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 1,
"selected": false,
"text": "<p>Check two things: </p>\n\n<ul>\n<li>in the wp-options table, the site URLs (in two places) should be t... | 2019/02/03 | [
"https://wordpress.stackexchange.com/questions/327554",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160439/"
] | So I recently, built and LAMP server and installed wordpress on it. I connected it to the web via a reverse ssh tunnel using serveo.net. I decided to add ssl and the rest of the website seem to work fine, but wordpress keeps breaking when I try to use ssl. I went to the general settings and changed the urls to http ins... | Check two things:
* in the wp-options table, the site URLs (in two places) should be the full URL, as in <https://www.example.com> .
* check the site's htaccess file for proper rewrite of http to https.
For a htaccess rule, this one works in most case:
```
RewriteEngine On
RewriteCond %{HTTPS} !=on
Rewrite... |
327,560 | <p>I am currently setting up a WordPress website and everything is going fine except for one issue I simply can't figure out.</p>
<p>So basically I have a booking form on my website that allows people to select a couple values (number of bedrooms and bathrooms) and then when they click the button those values are amen... | [
{
"answer_id": 327562,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 1,
"selected": false,
"text": "<p>Check two things: </p>\n\n<ul>\n<li>in the wp-options table, the site URLs (in two places) should be t... | 2019/02/03 | [
"https://wordpress.stackexchange.com/questions/327560",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160445/"
] | I am currently setting up a WordPress website and everything is going fine except for one issue I simply can't figure out.
So basically I have a booking form on my website that allows people to select a couple values (number of bedrooms and bathrooms) and then when they click the button those values are amended to the... | Check two things:
* in the wp-options table, the site URLs (in two places) should be the full URL, as in <https://www.example.com> .
* check the site's htaccess file for proper rewrite of http to https.
For a htaccess rule, this one works in most case:
```
RewriteEngine On
RewriteCond %{HTTPS} !=on
Rewrite... |
327,577 | <p>I have a native app project that gets all data from <code>/wp-json/wp/v2</code>.</p>
<p>I've registered phone using this</p>
<pre><code>register_meta('user', 'phone', array(
"type" => "string",
"show_in_rest" => true
));
</code></pre>
<p>to the functions.php and I can see the user metadata using thi... | [
{
"answer_id": 327602,
"author": "adeguk Loggcity",
"author_id": 160489,
"author_profile": "https://wordpress.stackexchange.com/users/160489",
"pm_score": 0,
"selected": false,
"text": "<p>I found these 2 post helpful</p>\n\n<ul>\n<li><a href=\"https://www.wpsuperstars.net/wordpress-rest... | 2019/02/04 | [
"https://wordpress.stackexchange.com/questions/327577",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160468/"
] | I have a native app project that gets all data from `/wp-json/wp/v2`.
I've registered phone using this
```
register_meta('user', 'phone', array(
"type" => "string",
"show_in_rest" => true
));
```
to the functions.php and I can see the user metadata using this
```
http://example.com/wp-json/wp/v2/users/1
`... | I had to do this yesterday, here's how I did it.
Like you have already done `register_meta` to appear in the api.
```php
register_meta('user', 'meta_key', array(
"type" => "string",
"show_in_rest" => true,
"single" => true,
));
```
Then you will need to make a POST or PUT request to the users endpoint w... |
327,597 | <p>I want users to change their avatar on a general site, because some plugins only work with that.
for example </p>
<blockquote>
<p>www.example.com/members/user1/profile/change-avatar/</p>
</blockquote>
<p>And </p>
<blockquote>
<p>www.example.com/members/user2/profile/change-avatar/</p>
</blockquote>
<p>Should... | [
{
"answer_id": 327615,
"author": "0Mr_X0",
"author_id": 160485,
"author_profile": "https://wordpress.stackexchange.com/users/160485",
"pm_score": 2,
"selected": true,
"text": "<p>Solved it.</p>\n\n<pre><code>add_action('init','redirect_to_change_avatar');\n\nfunction redirect_to_change_a... | 2019/02/04 | [
"https://wordpress.stackexchange.com/questions/327597",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160485/"
] | I want users to change their avatar on a general site, because some plugins only work with that.
for example
>
> www.example.com/members/user1/profile/change-avatar/
>
>
>
And
>
> www.example.com/members/user2/profile/change-avatar/
>
>
>
Should both redirect to
>
> www.example.com/change-avatar/
>
> ... | Solved it.
```
add_action('init','redirect_to_change_avatar');
function redirect_to_change_avatar() {
if ( strpos($_SERVER['REQUEST_URI'], '/profile/change-avatar/') !== false ) {
wp_redirect('/change-avatar/');
exit;
}
}
``` |
327,628 | <p>What is the easiest approach to iterate through the sub-sites (in Multi-Site network) and let's say <code>add_option("xyz", 123)</code> for each of site.</p>
| [
{
"answer_id": 327629,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": false,
"text": "<p>Well, you can get sites with <a href=\"https://developer.wordpress.org/reference/functions/get_sites/... | 2019/02/04 | [
"https://wordpress.stackexchange.com/questions/327628",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33667/"
] | What is the easiest approach to iterate through the sub-sites (in Multi-Site network) and let's say `add_option("xyz", 123)` for each of site. | Well, you can get sites with [`get_sites`](https://developer.wordpress.org/reference/functions/get_sites/) and loop through them:
```
if ( function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
$sites = get_sites();
foreach ( $sites as $site ) {
// do something
}
return;
}
``` |
327,634 | <p>I have this hook. How i can add this hook with get_template_part()? I created a file "myfile.php" where I store the HTML code of my search bar, but a can't manage to connect my template</p>
<pre><code>add_filter('wp_nav_menu_items', 'add_search_form', 10, 2);
function add_search_form($items, $args) {
if( $args-... | [
{
"answer_id": 327637,
"author": "Alexander Holsgrove",
"author_id": 48962,
"author_profile": "https://wordpress.stackexchange.com/users/48962",
"pm_score": 1,
"selected": false,
"text": "<p>OK, so one simple way would be to edit your template, I assume <code>header.php</code> for where ... | 2019/02/04 | [
"https://wordpress.stackexchange.com/questions/327634",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159993/"
] | I have this hook. How i can add this hook with get\_template\_part()? I created a file "myfile.php" where I store the HTML code of my search bar, but a can't manage to connect my template
```
add_filter('wp_nav_menu_items', 'add_search_form', 10, 2);
function add_search_form($items, $args) {
if( $args->theme_locat... | OK, so one simple way would be to edit your template, I assume `header.php` for where you want the menu to appear. Use the template include to load `myfile.php`
```
get_template_part('template-parts/myfile');
```
Then inside `myfile.php`:
```
<?php
$search .= '<li class="search"><form role="search" method="get" id... |
327,665 | <p>I spent some time in my DB trying to figure out how I can clean out some completed order data. Below is the query that I am confident will help remove the data from completed woocommerce orders. </p>
<p>My question is more of a DB Query one:</p>
<pre><code>DELETE * FROM wp_post
JOIN wp_postmeta ON wp_post.ID = wp_... | [
{
"answer_id": 327670,
"author": "mzykin",
"author_id": 160284,
"author_profile": "https://wordpress.stackexchange.com/users/160284",
"pm_score": 2,
"selected": false,
"text": "<p>Try <code>wp_posts</code> instead of <code>wp_post</code>.</p>\n"
},
{
"answer_id": 404818,
"aut... | 2019/02/04 | [
"https://wordpress.stackexchange.com/questions/327665",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6296/"
] | I spent some time in my DB trying to figure out how I can clean out some completed order data. Below is the query that I am confident will help remove the data from completed woocommerce orders.
My question is more of a DB Query one:
```
DELETE * FROM wp_post
JOIN wp_postmeta ON wp_post.ID = wp_postmeta.post_id
JOIN... | Try `wp_posts` instead of `wp_post`. |
327,698 | <p>I want to modify the output of <code>wp_link_pages</code>.</p>
<p>Basically what I need is to show Previous and Next buttons and current page/total number of pages.
I created the Previous and Next button. Now in between them I want to add a current page and the total pages number.</p>
<p>Here is my code</p>
<pre>... | [
{
"answer_id": 327670,
"author": "mzykin",
"author_id": 160284,
"author_profile": "https://wordpress.stackexchange.com/users/160284",
"pm_score": 2,
"selected": false,
"text": "<p>Try <code>wp_posts</code> instead of <code>wp_post</code>.</p>\n"
},
{
"answer_id": 404818,
"aut... | 2019/02/05 | [
"https://wordpress.stackexchange.com/questions/327698",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160548/"
] | I want to modify the output of `wp_link_pages`.
Basically what I need is to show Previous and Next buttons and current page/total number of pages.
I created the Previous and Next button. Now in between them I want to add a current page and the total pages number.
Here is my code
```
wp_link_pages( array(
'before... | Try `wp_posts` instead of `wp_post`. |
327,755 | <p>I'm going through some training on internationalization and escaping data. But I feel stuck with escaping the title attribute. I have the following code in a helper function...</p>
<pre><code> echo '<h2 class="m-title">';
printf(
esc_html__('%s','tn'),
'<a href="'.esc_url(get_pe... | [
{
"answer_id": 327758,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": true,
"text": "<p>Some screen readers read the title attribute plus the link text - so those visitors would hear \"Hello wor... | 2019/02/05 | [
"https://wordpress.stackexchange.com/questions/327755",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98671/"
] | I'm going through some training on internationalization and escaping data. But I feel stuck with escaping the title attribute. I have the following code in a helper function...
```
echo '<h2 class="m-title">';
printf(
esc_html__('%s','tn'),
'<a href="'.esc_url(get_permalink()).'" title="'.th... | Some screen readers read the title attribute plus the link text - so those visitors would hear "Hello world! Hello world!" - so unless your real title attribute is different than the link text and provides additional context to users of screen readers, you may wish to just not use the title attribute.
Or, you should b... |
327,799 | <p>I want to disable the default email that is send when user is registered.
I am using this plugin for email verification <code>User Verification
By PickPlugins</code>, which sends an email with confirmation link, but the problem is that by default and WordPress send an email via <code>pluggable.php</code>:</p>
<pre>... | [
{
"answer_id": 327758,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": true,
"text": "<p>Some screen readers read the title attribute plus the link text - so those visitors would hear \"Hello wor... | 2019/02/05 | [
"https://wordpress.stackexchange.com/questions/327799",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/152132/"
] | I want to disable the default email that is send when user is registered.
I am using this plugin for email verification `User Verification
By PickPlugins`, which sends an email with confirmation link, but the problem is that by default and WordPress send an email via `pluggable.php`:
```
function wp_new_user_notificat... | Some screen readers read the title attribute plus the link text - so those visitors would hear "Hello world! Hello world!" - so unless your real title attribute is different than the link text and provides additional context to users of screen readers, you may wish to just not use the title attribute.
Or, you should b... |
327,817 | <p>I am trying to change the text of the publish button to save</p>
<pre class="lang-php prettyprint-override"><code>function change_publish_button( $translation, $text ) {
if ( $text == 'Publish' )
return 'Save';
return $translation;
}
add_filter( 'gettext', 'change_publish_button', 10, 2 );
</code... | [
{
"answer_id": 327818,
"author": "Lucien Dubois",
"author_id": 51306,
"author_profile": "https://wordpress.stackexchange.com/users/51306",
"pm_score": -1,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>function translate_publish( $translated_text, $untranslated_text, $domain ... | 2019/02/06 | [
"https://wordpress.stackexchange.com/questions/327817",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160561/"
] | I am trying to change the text of the publish button to save
```php
function change_publish_button( $translation, $text ) {
if ( $text == 'Publish' )
return 'Save';
return $translation;
}
add_filter( 'gettext', 'change_publish_button', 10, 2 );
```
I am trying to run the above code but it doesn't ... | Put below code into your theme **functions.php** and try
```
function change_publish_button( $translation, $text ) {
if ( $text == 'Publish...' ) // Your button text
$text = 'Save';
return $text;
}
add_filter( 'gettext', 'change_publish_button', 10, 2 );
```
This one is worked for me
[![enter... |
327,839 | <p>I've almost finished my first custom theme for a website. I've created some custom post type to manage a portfolio and a staff member section. No problem with the code, but the client asked if is it possible to change the staff images when an user hover on it. Is there any way to achieve this in wordpress? </p>
<p>... | [
{
"answer_id": 327865,
"author": "mrben522",
"author_id": 84703,
"author_profile": "https://wordpress.stackexchange.com/users/84703",
"pm_score": 1,
"selected": false,
"text": "<p>This seems like a CSS problem and not a Wordpress problem. you just need hover styles that replace the back... | 2019/02/06 | [
"https://wordpress.stackexchange.com/questions/327839",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159508/"
] | I've almost finished my first custom theme for a website. I've created some custom post type to manage a portfolio and a staff member section. No problem with the code, but the client asked if is it possible to change the staff images when an user hover on it. Is there any way to achieve this in wordpress?
Here is a ... | You can add a custom field to you team page, call it "second\_picture", or whatever you want, and add the code
```
<div class="box">
<div class="rounded-circle" style="background-image:url('<?php the_post_thumbnail_url('full'); ?>')" id="staff-pic">
<div class="se... |
327,851 | <p>Could someone tell me where I could find detailed information about what has beend changed/improved in a new WordPress major/minor version? Maybe some kind of changelog or something?</p>
| [
{
"answer_id": 327865,
"author": "mrben522",
"author_id": 84703,
"author_profile": "https://wordpress.stackexchange.com/users/84703",
"pm_score": 1,
"selected": false,
"text": "<p>This seems like a CSS problem and not a Wordpress problem. you just need hover styles that replace the back... | 2019/02/06 | [
"https://wordpress.stackexchange.com/questions/327851",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/149002/"
] | Could someone tell me where I could find detailed information about what has beend changed/improved in a new WordPress major/minor version? Maybe some kind of changelog or something? | You can add a custom field to you team page, call it "second\_picture", or whatever you want, and add the code
```
<div class="box">
<div class="rounded-circle" style="background-image:url('<?php the_post_thumbnail_url('full'); ?>')" id="staff-pic">
<div class="se... |
327,870 | <p>I'm attempting to create a single WP loop, using a custom query, to display a custom-post-type - using Bootstrap 4 markup.
The complicating part for me is, I'd like the number of posts for each row to alternate in the following way:</p>
<ul>
<li>Row 1 - One Post - Full Screen width</li>
<li>Row 2 - Four Posts - co... | [
{
"answer_id": 327875,
"author": "mrben522",
"author_id": 84703,
"author_profile": "https://wordpress.stackexchange.com/users/84703",
"pm_score": 2,
"selected": true,
"text": "<p>The easy-but-a-bit-hacky way to get there would be to initialize a counter variable before your loop and then... | 2019/02/06 | [
"https://wordpress.stackexchange.com/questions/327870",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/135424/"
] | I'm attempting to create a single WP loop, using a custom query, to display a custom-post-type - using Bootstrap 4 markup.
The complicating part for me is, I'd like the number of posts for each row to alternate in the following way:
* Row 1 - One Post - Full Screen width
* Row 2 - Four Posts - col-md-6
* Row 3 - Six ... | The easy-but-a-bit-hacky way to get there would be to initialize a counter variable before your loop and then use that to tell what post you're on. something like so:
```
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$args = array(
'post_type' => 'workshop',
'post_status' ... |
327,911 | <p>Can anyone provide a sample MySQL or WP_Query code snippet that returns the most recent post for each author on a single WordPress site? For example, if the site has 10 authors but 500 posts, then the query would return 10 records where each record is the most recent post by each author. Thanks!</p>
| [
{
"answer_id": 327912,
"author": "Lucien Dubois",
"author_id": 51306,
"author_profile": "https://wordpress.stackexchange.com/users/51306",
"pm_score": -1,
"selected": false,
"text": "<p>You could first get the users and then run a WP_Query for each:.\n(That would be the fast, easy, but n... | 2019/02/07 | [
"https://wordpress.stackexchange.com/questions/327911",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/149633/"
] | Can anyone provide a sample MySQL or WP\_Query code snippet that returns the most recent post for each author on a single WordPress site? For example, if the site has 10 authors but 500 posts, then the query would return 10 records where each record is the most recent post by each author. Thanks! | You can write a SQL query to achieve this:
```php
<?php
$sql = <<<SQL
SELECT
p.ID,
p.post_title,
p.post_author
FROM {$GLOBALS['wpdb']->posts} p INNER JOIN (
SELECT ID, post_title
FROM {$GLOBALS['wpdb']->posts} ORDER BY post_date DESC
) s ON p.ID=s.ID
WHERE
p.post_type = 'post'
AND
... |
327,945 | <p>I'd like to keep the pagination links for /page/2/, /page/373/, etc but instead of changing the URL on the browser i want everything to load on the archive main page.</p>
<p>Ideally all those paginated URLs should redirect to the first page of the archive.</p>
<p>I don't want a "load more" button i want to keep th... | [
{
"answer_id": 328271,
"author": "mtthias",
"author_id": 160740,
"author_profile": "https://wordpress.stackexchange.com/users/160740",
"pm_score": 2,
"selected": false,
"text": "<p>Very high Level:</p>\n\n<ul>\n<li>Via Javascript register an eventhandler for clicking on pagination links<... | 2019/02/07 | [
"https://wordpress.stackexchange.com/questions/327945",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/77283/"
] | I'd like to keep the pagination links for /page/2/, /page/373/, etc but instead of changing the URL on the browser i want everything to load on the archive main page.
Ideally all those paginated URLs should redirect to the first page of the archive.
I don't want a "load more" button i want to keep the logic of pages ... | you might use the [`$.load`](http://api.jquery.com/load/) and [`preventDefault()`](https://api.jquery.com/event.preventdefault/) from jQuery.
Assugming that you have `.page-link` link class on each url in pagination and you have all the posts in the `#content` div following code can help you to load the posts in that... |
327,966 | <p>What I am trying to do is to use specific Reusable Blocks, that are editable by certain admins in the back end, within block templates for custom post types. So if you register a CTP or edit the capabilities of standard post types, you can use them like:</p>
<pre><code> function create_add_post_types() {
reg... | [
{
"answer_id": 327967,
"author": "Playnary",
"author_id": 148976,
"author_profile": "https://wordpress.stackexchange.com/users/148976",
"pm_score": 3,
"selected": true,
"text": "<p>I actually found a solution myself by following the way a reusable block is registered in <a href=\"https:/... | 2019/02/07 | [
"https://wordpress.stackexchange.com/questions/327966",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/148976/"
] | What I am trying to do is to use specific Reusable Blocks, that are editable by certain admins in the back end, within block templates for custom post types. So if you register a CTP or edit the capabilities of standard post types, you can use them like:
```
function create_add_post_types() {
register_post_typ... | I actually found a solution myself by following the way a reusable block is registered in [this stackexchange thread](https://wordpress.stackexchange.com/questions/324908/removing-default-gutenberg-blocks-but-keeping-reusable-block-functionality):
Reusable blocks are all stored in/as **core/block** and this block has ... |
328,005 | <p>/wp-json/wc/v3/products/categories</p>
<p>My site has 10 main categories. But when I run the query, only 3 main categories and their subcategories are listed. Other categories don’t come up with what could be the problem?</p>
| [
{
"answer_id": 327967,
"author": "Playnary",
"author_id": 148976,
"author_profile": "https://wordpress.stackexchange.com/users/148976",
"pm_score": 3,
"selected": true,
"text": "<p>I actually found a solution myself by following the way a reusable block is registered in <a href=\"https:/... | 2019/02/07 | [
"https://wordpress.stackexchange.com/questions/328005",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160786/"
] | /wp-json/wc/v3/products/categories
My site has 10 main categories. But when I run the query, only 3 main categories and their subcategories are listed. Other categories don’t come up with what could be the problem? | I actually found a solution myself by following the way a reusable block is registered in [this stackexchange thread](https://wordpress.stackexchange.com/questions/324908/removing-default-gutenberg-blocks-but-keeping-reusable-block-functionality):
Reusable blocks are all stored in/as **core/block** and this block has ... |
328,006 | <p>I have created a WordPress multisite on the primary domain alaksns.com which is secure with ssl certificate. Then I added a new site as blog.alaksns.com which only works when accessed with http whenver I try to access it with https it gives a blankpage. I also tried by changing the url of the site from the network s... | [
{
"answer_id": 327967,
"author": "Playnary",
"author_id": 148976,
"author_profile": "https://wordpress.stackexchange.com/users/148976",
"pm_score": 3,
"selected": true,
"text": "<p>I actually found a solution myself by following the way a reusable block is registered in <a href=\"https:/... | 2019/02/07 | [
"https://wordpress.stackexchange.com/questions/328006",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160787/"
] | I have created a WordPress multisite on the primary domain alaksns.com which is secure with ssl certificate. Then I added a new site as blog.alaksns.com which only works when accessed with http whenver I try to access it with https it gives a blankpage. I also tried by changing the url of the site from the network sett... | I actually found a solution myself by following the way a reusable block is registered in [this stackexchange thread](https://wordpress.stackexchange.com/questions/324908/removing-default-gutenberg-blocks-but-keeping-reusable-block-functionality):
Reusable blocks are all stored in/as **core/block** and this block has ... |
328,018 | <p>I'm converting my posts over to use the new Block Editor. In the past I added an icon to the end of every post to act as a signature and marker saying the article is over (like print magazines do).</p>
<p>I did it like this:</p>
<pre><code>// Add Signature Image at End of Posts
add_filter('the_content','td_add_sig... | [
{
"answer_id": 328027,
"author": "tmdesigned",
"author_id": 28273,
"author_profile": "https://wordpress.stackexchange.com/users/28273",
"pm_score": 1,
"selected": true,
"text": "<p>So from a WordPress conceptual point of view, I like the idea of it being a block better. Without it being ... | 2019/02/07 | [
"https://wordpress.stackexchange.com/questions/328018",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160792/"
] | I'm converting my posts over to use the new Block Editor. In the past I added an icon to the end of every post to act as a signature and marker saying the article is over (like print magazines do).
I did it like this:
```
// Add Signature Image at End of Posts
add_filter('the_content','td_add_signature', 1);
function... | So from a WordPress conceptual point of view, I like the idea of it being a block better. Without it being a block you have some of a post's content in the database, and some being injected here. It sounds fine for this case but would be prone to cause you headaches later down if some of your requirements changed.
Tha... |
328,028 | <p>I would like to show my most viewed categories (kind like the "<a href="https://wordpress.org/plugins/wp-postviews/" rel="nofollow noreferrer">WP-PostViews</a>" plugin).</p>
<p>I already did some research but I didn't find nothing about that. This made me think that it can't be done by some reason and I would like ... | [
{
"answer_id": 328027,
"author": "tmdesigned",
"author_id": 28273,
"author_profile": "https://wordpress.stackexchange.com/users/28273",
"pm_score": 1,
"selected": true,
"text": "<p>So from a WordPress conceptual point of view, I like the idea of it being a block better. Without it being ... | 2019/02/07 | [
"https://wordpress.stackexchange.com/questions/328028",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18693/"
] | I would like to show my most viewed categories (kind like the "[WP-PostViews](https://wordpress.org/plugins/wp-postviews/)" plugin).
I already did some research but I didn't find nothing about that. This made me think that it can't be done by some reason and I would like to know more about it... | So from a WordPress conceptual point of view, I like the idea of it being a block better. Without it being a block you have some of a post's content in the database, and some being injected here. It sounds fine for this case but would be prone to cause you headaches later down if some of your requirements changed.
Tha... |
328,030 | <p>I have several 404 errors with a URL such as: myWebsite/tag/foo/page/4/. Page no longer exists because a few posts were deleted tagged as "foo." Which is better: 301 redirect that to myWebsite/tag/foo/page/1/? Or just 410 delete them? </p>
<p>I'm thinking if I do a 301 redirect -- then add more posts tagged as "foo... | [
{
"answer_id": 328027,
"author": "tmdesigned",
"author_id": 28273,
"author_profile": "https://wordpress.stackexchange.com/users/28273",
"pm_score": 1,
"selected": true,
"text": "<p>So from a WordPress conceptual point of view, I like the idea of it being a block better. Without it being ... | 2019/02/08 | [
"https://wordpress.stackexchange.com/questions/328030",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105596/"
] | I have several 404 errors with a URL such as: myWebsite/tag/foo/page/4/. Page no longer exists because a few posts were deleted tagged as "foo." Which is better: 301 redirect that to myWebsite/tag/foo/page/1/? Or just 410 delete them?
I'm thinking if I do a 301 redirect -- then add more posts tagged as "foo," a 4th p... | So from a WordPress conceptual point of view, I like the idea of it being a block better. Without it being a block you have some of a post's content in the database, and some being injected here. It sounds fine for this case but would be prone to cause you headaches later down if some of your requirements changed.
Tha... |
328,034 | <p>i have two websites i use Wordpress comments on one website and jetpack comments on another. Both websites shows website column, how do i remove it to save my site from giving unwanted backlinks ?</p>
| [
{
"answer_id": 328035,
"author": "Lucien Dubois",
"author_id": 51306,
"author_profile": "https://wordpress.stackexchange.com/users/51306",
"pm_score": 2,
"selected": false,
"text": "<p>I guess you are talking about the website \"field\". If it is so, add this code in the functions.php fi... | 2019/02/08 | [
"https://wordpress.stackexchange.com/questions/328034",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | i have two websites i use Wordpress comments on one website and jetpack comments on another. Both websites shows website column, how do i remove it to save my site from giving unwanted backlinks ? | **1. Using Plugins to disable Website field from comments**
There are many plugins available in the WordPress repository that remove the Website field from the blog comments.
The most easy way is to install Remove Fields or Remove Comment Website/URL Box.
<https://wordpress.org/plugins/remove-fields/>
**2. Editing ... |
328,036 | <p>I have an ACF field of <code>paid_attendance</code> - I only want it to display the field if the value is greater than 0. The below code only works if I swap <code>>0</code> out for an actual number (and that number matches the number set on the backend for a particular post(s). </p>
<p>Also, if I were to wrap t... | [
{
"answer_id": 328035,
"author": "Lucien Dubois",
"author_id": 51306,
"author_profile": "https://wordpress.stackexchange.com/users/51306",
"pm_score": 2,
"selected": false,
"text": "<p>I guess you are talking about the website \"field\". If it is so, add this code in the functions.php fi... | 2019/02/08 | [
"https://wordpress.stackexchange.com/questions/328036",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159682/"
] | I have an ACF field of `paid_attendance` - I only want it to display the field if the value is greater than 0. The below code only works if I swap `>0` out for an actual number (and that number matches the number set on the backend for a particular post(s).
Also, if I were to wrap the below in a div with an `<h4>` of... | **1. Using Plugins to disable Website field from comments**
There are many plugins available in the WordPress repository that remove the Website field from the blog comments.
The most easy way is to install Remove Fields or Remove Comment Website/URL Box.
<https://wordpress.org/plugins/remove-fields/>
**2. Editing ... |
328,068 | <p>I use the following ACF query to generate a list, works perfectly.</p>
<p>Now, however, I want to order my list by standard WP “post title” instead of ACF custom field “datum”</p>
<p>How can I do that ?</p>
<pre><code>// args
$args = array(
'posts_per_page' => 999,
'post_type' => 'lezing',
'order... | [
{
"answer_id": 328070,
"author": "Alexander Holsgrove",
"author_id": 48962,
"author_profile": "https://wordpress.stackexchange.com/users/48962",
"pm_score": 0,
"selected": false,
"text": "<p>Your query will order using the meta term. To order by the post title, you just need to change th... | 2019/02/08 | [
"https://wordpress.stackexchange.com/questions/328068",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160822/"
] | I use the following ACF query to generate a list, works perfectly.
Now, however, I want to order my list by standard WP “post title” instead of ACF custom field “datum”
How can I do that ?
```
// args
$args = array(
'posts_per_page' => 999,
'post_type' => 'lezing',
'orderby' => 'meta_value',
'order' =>... | That query has nothing to do with ACF. It's a regular post query using WordPress' standard query class. As such you can refer to [the documentation](https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters) for the options for ordering your query.
To sort by post title you just need to set... |
328,082 | <p>I'm trying to remove trailing slash from a link which I get from <code>previous_posts_link()</code> function. Here is my code:</p>
<pre><code><?php rtrim(previous_posts_link( __( 'text', 'name' ) ), '/'); ?>
</code></pre>
<p>Unfortunetly it doesn't work and I still get the slash at the end of url.</p>
| [
{
"answer_id": 328085,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 3,
"selected": true,
"text": "<p>There's two problems here:</p>\n\n<ol>\n<li><code>previous_posts_link()</code> <em>echoes</em> the link,... | 2019/02/08 | [
"https://wordpress.stackexchange.com/questions/328082",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/145150/"
] | I'm trying to remove trailing slash from a link which I get from `previous_posts_link()` function. Here is my code:
```
<?php rtrim(previous_posts_link( __( 'text', 'name' ) ), '/'); ?>
```
Unfortunetly it doesn't work and I still get the slash at the end of url. | There's two problems here:
1. `previous_posts_link()` *echoes* the link, rather than returning it.
2. `previous_posts_link()` returns the full HTML of the link, including `<a href="">` etc.
The problem with #1 is that for you to be able pass the result of a function to another function (such as `rtrim()`) as an argum... |
328,121 | <p>Question: how can I change text within the Block Editor itself?</p>
<ul>
<li><p>When a user with edit but not publish permissions makes changes to a published post and clicks "submit for review," the Block Editor presents a "post reverted to draft" success message. I would like to change this to my own text.</p></l... | [
{
"answer_id": 328423,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not able to test it right now, so I won't guarantee that it will work, but...</p>\n\n<h2>1. post ... | 2019/02/08 | [
"https://wordpress.stackexchange.com/questions/328121",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/102815/"
] | Question: how can I change text within the Block Editor itself?
* When a user with edit but not publish permissions makes changes to a published post and clicks "submit for review," the Block Editor presents a "post reverted to draft" success message. I would like to change this to my own text.
* Also, in the Block Ed... | Changing the "*Post reverted to draft.*" text
---------------------------------------------
In WordPress version 5.0, WordPress introduced a new post type label which has the key `item_reverted_to_draft` and it's [defined](https://developer.wordpress.org/reference/functions/get_post_type_labels/#description) as:
>
>... |
328,125 | <p>I just deployed a new Wordpress site. Everything looks good, now I'm setting up jQuery:</p>
<p><em>Child theme</em> <strong>functions.php:</strong></p>
<pre><code>//enqueue scripts
function my_theme_enqueue_scripts() {
wp_register_script( 'myjs', get_stylesheet_directory_uri() . '/my.js', array('jquery'),'1.0.... | [
{
"answer_id": 328127,
"author": "Mohsin Ghouri",
"author_id": 159253,
"author_profile": "https://wordpress.stackexchange.com/users/159253",
"pm_score": 2,
"selected": false,
"text": "<p>The code seems fine. Please check by loading the script in the footer and also use the wp_footer in y... | 2019/02/08 | [
"https://wordpress.stackexchange.com/questions/328125",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/64243/"
] | I just deployed a new Wordpress site. Everything looks good, now I'm setting up jQuery:
*Child theme* **functions.php:**
```
//enqueue scripts
function my_theme_enqueue_scripts() {
wp_register_script( 'myjs', get_stylesheet_directory_uri() . '/my.js', array('jquery'),'1.0.0');
wp_enqueue_script('myjs');
}
add... | The code seems fine. Please check by loading the script in the footer and also use the wp\_footer in your .php file. |
328,142 | <p>I am showing comments on my page. I want to show 1 ad after every 2 comments.</p>
<p><code><div class="panel-ads clearfix"></div></code> it's repeating the number of comments. </p>
<p>I would like to add the ad code after every 2 comments. </p>
<p>For example:</p>
<pre><code><div class="panel-ads ... | [
{
"answer_id": 328155,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 3,
"selected": true,
"text": "<h2>The <code>end-callback</code> of <code>wp_list_comments()</code></h2>\n\n<p>One way is to use the <code>end-c... | 2019/02/08 | [
"https://wordpress.stackexchange.com/questions/328142",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160866/"
] | I am showing comments on my page. I want to show 1 ad after every 2 comments.
`<div class="panel-ads clearfix"></div>` it's repeating the number of comments.
I would like to add the ad code after every 2 comments.
For example:
```
<div class="panel-ads clearfix"></div>
<div class="panel-ads clearfix"></div>
/*
... | The `end-callback` of `wp_list_comments()`
------------------------------------------
One way is to use the `end-callback` argument in:
```
wp_list_comments( [
'end-callback' => 'wpse_comments_ads_injection',
... other arguments ...
], $comments );
```
in addtion to your other `wp_list_comments` arguments,... |
328,176 | <p>I have registered a custom post type using <code>register_post_type('myposttype', ...)</code>. On published posts, there is a custom class that gets applied to the whole body of the page, <code>single-myposttype</code>. I apply css rules using this body class to make the post appear differently from non-custom post ... | [
{
"answer_id": 328229,
"author": "mtthias",
"author_id": 160740,
"author_profile": "https://wordpress.stackexchange.com/users/160740",
"pm_score": 4,
"selected": true,
"text": "<p>This hook should add a single-[post_type] class to the body of the editor page.</p>\n\n<pre><code>add_filter... | 2019/02/09 | [
"https://wordpress.stackexchange.com/questions/328176",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34991/"
] | I have registered a custom post type using `register_post_type('myposttype', ...)`. On published posts, there is a custom class that gets applied to the whole body of the page, `single-myposttype`. I apply css rules using this body class to make the post appear differently from non-custom post types posts.
Now that t... | This hook should add a single-[post\_type] class to the body of the editor page.
```
add_filter('admin_body_class', function ($classes) {
//get current page
global $pagenow;
//check if the current page is post.php and if the post parameteris set
if ( $pagenow ==='post.php' && isset($_... |
328,194 | <p>I have problem to display custom taxonomy under custom admin menu. Custom post types are displayed properly, but the taxonomy doesn't appear.</p>
<p>I added to custom post types: <strong>'show_in_menu' => 'my-menu'</strong></p>
<p><strong>My Custom Menu</strong></p>
<ul>
<li><strong>Custom Post Type 1</strong></l... | [
{
"answer_id": 328198,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": -1,
"selected": false,
"text": "<p>I think that there is an issue with your plugins. That's why, custom taxonomy is not showing... | 2019/02/09 | [
"https://wordpress.stackexchange.com/questions/328194",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/138812/"
] | I have problem to display custom taxonomy under custom admin menu. Custom post types are displayed properly, but the taxonomy doesn't appear.
I added to custom post types: **'show\_in\_menu' => 'my-menu'**
**My Custom Menu**
* **Custom Post Type 1**
* **Custom Post Type 2**
* **Custom Post Type 3**
* **Custom Taxono... | You haven't properly registered the taxonomy for your post type. You register your post type like this:
```
register_post_type( 'custom-post-type-1',
```
Meaning that your post type is named `custom-post-type-1`. But when you register the taxonomy, you're registering it for a post type called `my-menu`"
```
registe... |
328,195 | <p>Since Wordpress 5.x they've removed the thumbnail size option for galleries. Is there a way to activate or build a workaround? I like to build up a classic Lightbox gallery. </p>
<p><a href="https://i.stack.imgur.com/rpbXa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rpbXa.png" alt="enter imag... | [
{
"answer_id": 328199,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": 2,
"selected": false,
"text": "<p>There is a project going on about the image sizes. You can follow it <a href=\"https://github... | 2019/02/09 | [
"https://wordpress.stackexchange.com/questions/328195",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/141935/"
] | Since Wordpress 5.x they've removed the thumbnail size option for galleries. Is there a way to activate or build a workaround? I like to build up a classic Lightbox gallery.
[](https://i.stack.imgur.com/rpbXa.png) | There is a project going on about the image sizes. You can follow it [right here](https://github.com/WordPress/gutenberg/issues/6177).
Right now, you can try using **shortcode\_atts\_gallery** filter. Take a look at these codes to get a hint:
```
/* Register shortcode_atts_gallery filter callback */
add_filter( 'sho... |
328,219 | <p>If I make a theme and add hard-coded text using <code>_e()</code>, <code>__()</code>, <code>esc_attr()</code> and so on. Could I do this in polish (or whichever language) and then add English translation po/mo files with the other languages I want to include or is this backwards and bad practice?</p>
| [
{
"answer_id": 328199,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": 2,
"selected": false,
"text": "<p>There is a project going on about the image sizes. You can follow it <a href=\"https://github... | 2019/02/09 | [
"https://wordpress.stackexchange.com/questions/328219",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158034/"
] | If I make a theme and add hard-coded text using `_e()`, `__()`, `esc_attr()` and so on. Could I do this in polish (or whichever language) and then add English translation po/mo files with the other languages I want to include or is this backwards and bad practice? | There is a project going on about the image sizes. You can follow it [right here](https://github.com/WordPress/gutenberg/issues/6177).
Right now, you can try using **shortcode\_atts\_gallery** filter. Take a look at these codes to get a hint:
```
/* Register shortcode_atts_gallery filter callback */
add_filter( 'sho... |
328,249 | <p>I found the API reference here: <a href="https://v2.wp-api.org/reference/posts/" rel="nofollow noreferrer">https://v2.wp-api.org/reference/posts/</a></p>
<p>Based on the API reference above, I wrote this Python code:</p>
<pre><code>from urllib.request import Request, urlopen
from datetime import datetime
import j... | [
{
"answer_id": 328269,
"author": "prathamesh patil",
"author_id": 160954,
"author_profile": "https://wordpress.stackexchange.com/users/160954",
"pm_score": 0,
"selected": false,
"text": "<p>I think you are missing out on the authentication part , check this <a href=\"https://stackoverflo... | 2019/02/10 | [
"https://wordpress.stackexchange.com/questions/328249",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/145576/"
] | I found the API reference here: <https://v2.wp-api.org/reference/posts/>
Based on the API reference above, I wrote this Python code:
```
from urllib.request import Request, urlopen
from datetime import datetime
import json
def create(wordpressUrl, content):
params = {
'date_gmt': datetime.now().replace... | as `@prathamesh patil` say, you missed the `authentication` = `your jwt token`
### how to generate `jwt token` ?
* simple = core logic
+ install and enable WordPress plugin: [JWT Authentication for WP REST API](https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/)
+ wordpress server enable `HTTP:Author... |
328,256 | <p>I wrote a simple plugin which creates a post type named <strong>cryptoevent</strong> and also creates a <strong>metabox</strong> that have some custom fields, I display this post type and fields with <strong>WP_Query</strong>, now I want to display them with a load more button, note this is supposed to be a plugin a... | [
{
"answer_id": 328274,
"author": "tmdesigned",
"author_id": 28273,
"author_profile": "https://wordpress.stackexchange.com/users/28273",
"pm_score": 1,
"selected": false,
"text": "<p>If you want it to work like a true \"load more\" button, then you are going to have to let the posts load ... | 2019/02/10 | [
"https://wordpress.stackexchange.com/questions/328256",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160944/"
] | I wrote a simple plugin which creates a post type named **cryptoevent** and also creates a **metabox** that have some custom fields, I display this post type and fields with **WP\_Query**, now I want to display them with a load more button, note this is supposed to be a plugin and I don't want user to have to do change... | If you want it to work like a true "load more" button, then you are going to have to let the posts load in groups without the user changing pages. This means you have to use an AJAX method. This is much more complicated than the WordPress loop you have right now.
Overall it works like this, with your code split into 2... |
328,277 | <p>I'm working on a plugin that defined a custom block for the Gutenberg/Block Editor. The block shows a <code>select</code> box of posts. When you select one, I create HTML with some of the selected post's fields, such as title, date, etc.</p>
<p>When I query my posts in the <code>edit</code> method, my code correctl... | [
{
"answer_id": 330953,
"author": "Marc Heiduk",
"author_id": 162686,
"author_profile": "https://wordpress.stackexchange.com/users/162686",
"pm_score": 3,
"selected": false,
"text": "<p>Gutenberg documentation is not finished yet, but there are some unreleased commits in the official Gute... | 2019/02/10 | [
"https://wordpress.stackexchange.com/questions/328277",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160955/"
] | I'm working on a plugin that defined a custom block for the Gutenberg/Block Editor. The block shows a `select` box of posts. When you select one, I create HTML with some of the selected post's fields, such as title, date, etc.
When I query my posts in the `edit` method, my code correctly produces a list of pages (in m... | If you look into the source code for `getEntityRecords`, you'll see that the the `core/data` library creates entities using the Wordpress API in [entities.js](https://github.com/WordPress/gutenberg/blob/master/packages/core-data/src/entities.js).
So you can use any parameter available in the [REST API](https://develop... |
328,283 | <p>I copied this code from a youtuber. It works for him, but not for me. Does the code contain any errors? As soon as I put it in, my WordPress breaks and won’t load. </p>
<pre><code>function gt_custom_post_type() {
register_post_type('project',
array(
'rewrite' => array('slug' => 'projects'),
... | [
{
"answer_id": 330953,
"author": "Marc Heiduk",
"author_id": 162686,
"author_profile": "https://wordpress.stackexchange.com/users/162686",
"pm_score": 3,
"selected": false,
"text": "<p>Gutenberg documentation is not finished yet, but there are some unreleased commits in the official Gute... | 2019/02/10 | [
"https://wordpress.stackexchange.com/questions/328283",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160967/"
] | I copied this code from a youtuber. It works for him, but not for me. Does the code contain any errors? As soon as I put it in, my WordPress breaks and won’t load.
```
function gt_custom_post_type() {
register_post_type('project',
array(
'rewrite' => array('slug' => 'projects'),
'labels' => array(
... | If you look into the source code for `getEntityRecords`, you'll see that the the `core/data` library creates entities using the Wordpress API in [entities.js](https://github.com/WordPress/gutenberg/blob/master/packages/core-data/src/entities.js).
So you can use any parameter available in the [REST API](https://develop... |
328,318 | <p>Centos 6 sys with php5.3.3, php5.6 and php7.0.<br>
Virtual Host set with php5.3.3
Just installed WP.<br>
Adding a plugin I get: </p>
<blockquote>
<p>Adaptive Images Error — PHP GD image library missing<br>
The PHP GD
image library is not detected in your server. ...</p>
</blockquote>
<pre><code>php -m | ... | [
{
"answer_id": 330953,
"author": "Marc Heiduk",
"author_id": 162686,
"author_profile": "https://wordpress.stackexchange.com/users/162686",
"pm_score": 3,
"selected": false,
"text": "<p>Gutenberg documentation is not finished yet, but there are some unreleased commits in the official Gute... | 2019/02/10 | [
"https://wordpress.stackexchange.com/questions/328318",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66849/"
] | Centos 6 sys with php5.3.3, php5.6 and php7.0.
Virtual Host set with php5.3.3
Just installed WP.
Adding a plugin I get:
>
> Adaptive Images Error — PHP GD image library missing
>
> The PHP GD
> image library is not detected in your server. ...
>
>
>
```
php -m | grep -i gd
```
>
> gd
>
>
>
```
... | If you look into the source code for `getEntityRecords`, you'll see that the the `core/data` library creates entities using the Wordpress API in [entities.js](https://github.com/WordPress/gutenberg/blob/master/packages/core-data/src/entities.js).
So you can use any parameter available in the [REST API](https://develop... |
328,331 | <p>I am trying to insert a new post with a simple ajax form in a wordpress plugin. Visitors will use this form to create posts from frontend.</p>
<p>My form is like this:</p>
<pre><code><script>
jQuery( document ).ready(function() {
jQuery('input[type=submit]').on('click', function() {
var ajaxurl =... | [
{
"answer_id": 328339,
"author": "moped",
"author_id": 160324,
"author_profile": "https://wordpress.stackexchange.com/users/160324",
"pm_score": -1,
"selected": false,
"text": "<p>Your form calls action 'create-event', your ajax function is 'save_post'.\nTell your ajax script which actio... | 2019/02/11 | [
"https://wordpress.stackexchange.com/questions/328331",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160985/"
] | I am trying to insert a new post with a simple ajax form in a wordpress plugin. Visitors will use this form to create posts from frontend.
My form is like this:
```
<script>
jQuery( document ).ready(function() {
jQuery('input[type=submit]').on('click', function() {
var ajaxurl = 'https://example.com/wp-ad... | Finally found the problem. The `action: save_post` was missing from data in ajax call. This code works:
```
<script>
jQuery( document ).ready(function() {
jQuery('input[type=button]').on('click', function() {
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
jQuery.ajax(... |
328,353 | <p>I'm about to convert my Bootstrap template to a custom Wordpress theme and have a little issue. </p>
<p>I want to display all of my blog posts. So far, it is working well. But here is the thing: Because of my design preferences I want to change the used styles for the displayed posts after a specific post. So let's... | [
{
"answer_id": 328339,
"author": "moped",
"author_id": 160324,
"author_profile": "https://wordpress.stackexchange.com/users/160324",
"pm_score": -1,
"selected": false,
"text": "<p>Your form calls action 'create-event', your ajax function is 'save_post'.\nTell your ajax script which actio... | 2019/02/11 | [
"https://wordpress.stackexchange.com/questions/328353",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160998/"
] | I'm about to convert my Bootstrap template to a custom Wordpress theme and have a little issue.
I want to display all of my blog posts. So far, it is working well. But here is the thing: Because of my design preferences I want to change the used styles for the displayed posts after a specific post. So let's say for t... | Finally found the problem. The `action: save_post` was missing from data in ajax call. This code works:
```
<script>
jQuery( document ).ready(function() {
jQuery('input[type=button]').on('click', function() {
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
jQuery.ajax(... |
328,354 | <p>So, I was doing some SEO work for my company's website. The website is an online e-shop, where you can learn about their products and make an order. They also got a blog. So far so good.
The set up is Wordpress obviously along with WooCommerce.</p>
<p>What I see is that there is an option to add a product and anoth... | [
{
"answer_id": 328358,
"author": "Alexander Holsgrove",
"author_id": 48962,
"author_profile": "https://wordpress.stackexchange.com/users/48962",
"pm_score": 0,
"selected": false,
"text": "<p>Yes, you can register the WooCommerce product tags (taxonomy) on your posts. Normally this would ... | 2019/02/11 | [
"https://wordpress.stackexchange.com/questions/328354",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159988/"
] | So, I was doing some SEO work for my company's website. The website is an online e-shop, where you can learn about their products and make an order. They also got a blog. So far so good.
The set up is Wordpress obviously along with WooCommerce.
What I see is that there is an option to add a product and another option ... | OK, so you can use `created_term` hook to make the product tags copy themselves automatically to post tags.
```
function ( $term_id, $tt_id, $taxonomy ) {
if ( 'product_tag' == $taxonomy ) {
$term = get_term( $term_id, $taxonomy );
wp_insert_term( $term->name, 'post_tag' );
}
}
add_action( 'cre... |
328,384 | <p>Hi trying this code below to get working, but no look so far.
Idea is simple if page template is <strong>page-47.php</strong> display <code><h1>Something</h1></code> else <code><h1>This will show on any other page</h1></code> .</p>
<pre><code><?php if ( is_page_template( 'page-47.php' ) )... | [
{
"answer_id": 328427,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 5,
"selected": true,
"text": "<p><code>is_page_template()</code> will only tell you if the page is using a <em>custom</em> page template.... | 2019/02/11 | [
"https://wordpress.stackexchange.com/questions/328384",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153778/"
] | Hi trying this code below to get working, but no look so far.
Idea is simple if page template is **page-47.php** display `<h1>Something</h1>` else `<h1>This will show on any other page</h1>` .
```
<?php if ( is_page_template( 'page-47.php' ) ): ?>
<h1>Something</h1>
<?php else: ?>
<h1>This will show on any ot... | `is_page_template()` will only tell you if the page is using a *custom* page template. Meaning a template that was created by adding the `Template Name:` comment to the file and selecting it from the Template dropdown, as described [here](https://developer.wordpress.org/themes/template-files-section/page-template-files... |
328,408 | <p>When viewing a draft page on the frontend, I'd like to see that status right away on the page itself. Currently, there is zero indication. Is there any way to have draft-specific CSS (or even just a header message?)</p>
| [
{
"answer_id": 328412,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 4,
"selected": true,
"text": "<p>There is probably a better way but you could add the following CSS to your stylesheet, which will add a l... | 2019/02/11 | [
"https://wordpress.stackexchange.com/questions/328408",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/161026/"
] | When viewing a draft page on the frontend, I'd like to see that status right away on the page itself. Currently, there is zero indication. Is there any way to have draft-specific CSS (or even just a header message?) | There is probably a better way but you could add the following CSS to your stylesheet, which will add a little banner when viewing a page that has a status of draft.
```
.status-draft.hentry:before {
content: "Previewing a Draft";
background: #87C5D6 !important;
display: block;
text-align: center;
}
`... |
328,411 | <p>I'd like to re-order the search results based on post meta and date . The post meta key is <code>_prioritize_s</code> and the value isn't important. So in a "normal" meta query, I'd just write the <code>compare</code> parameters to check EXISTS/NOT EXISTS. While I have experience with meta queries, I've never had to... | [
{
"answer_id": 328412,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 4,
"selected": true,
"text": "<p>There is probably a better way but you could add the following CSS to your stylesheet, which will add a l... | 2019/02/11 | [
"https://wordpress.stackexchange.com/questions/328411",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/42783/"
] | I'd like to re-order the search results based on post meta and date . The post meta key is `_prioritize_s` and the value isn't important. So in a "normal" meta query, I'd just write the `compare` parameters to check EXISTS/NOT EXISTS. While I have experience with meta queries, I've never had to re-order search results ... | There is probably a better way but you could add the following CSS to your stylesheet, which will add a little banner when viewing a page that has a status of draft.
```
.status-draft.hentry:before {
content: "Previewing a Draft";
background: #87C5D6 !important;
display: block;
text-align: center;
}
`... |