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
328,413
<pre><code>&lt;select name="select-city" onchange="location = this.value;"&gt; &lt;option value=""&gt;Select a post to read&lt;/option&gt; &lt;?php if ( is_user_logged_in() ): global $current_user; wp_get_current_user(); $author_query = array('posts_per_page' =&gt; '-1','author' =&gt; $curre...
[ { "answer_id": 328415, "author": "Fabrizio Mele", "author_id": 40463, "author_profile": "https://wordpress.stackexchange.com/users/40463", "pm_score": 0, "selected": false, "text": "<p>You have incorrectly placed your <code>endwhile</code> instruction. You code is entering the while-loop...
2019/02/11
[ "https://wordpress.stackexchange.com/questions/328413", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/28838/" ]
``` <select name="select-city" onchange="location = this.value;"> <option value="">Select a post to read</option> <?php if ( is_user_logged_in() ): global $current_user; wp_get_current_user(); $author_query = array('posts_per_page' => '-1','author' => $current_user->ID); $author_post...
Let's start with proper indenting your code: ``` <select name="select-city" onchange="location = this.value;"> <option value="">Select a post to read</option> <?php if ( is_user_logged_in() ): global $current_user; wp_get_current_user(); $author_query = array('posts_...
328,417
<p>Does anyone know another way to redirect without header(); giving me this error? <code>wp_redirect</code> doesn't work for me either...</p> <p>This is the error I'm getting:</p> <blockquote> <p>Warning: Cannot modify header information - headers already sent by (output started at /home/my_site/public_html/wp...
[ { "answer_id": 328420, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>There is no way do perform a redirect, if you already printed anything to the browser. (To make a redi...
2019/02/11
[ "https://wordpress.stackexchange.com/questions/328417", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/160874/" ]
Does anyone know another way to redirect without header(); giving me this error? `wp_redirect` doesn't work for me either... This is the error I'm getting: > > Warning: Cannot modify header information - headers already sent by > (output started at > /home/my\_site/public\_html/wp-content/themes/EHCC/page-secure.p...
There is no way do perform a redirect, if you already printed anything to the browser. (To make a redirect you have to send proper header to the browser. And headers have to be sent before any output.) So if you want to perform any redirects, you can't (and shouldn't) put such code directly in template. It should be p...
328,449
<p>I am able to get articles as RSS feed from below url</p> <pre><code>http://wordpress_site/blog/feed </code></pre> <p>I am also able to get articles from BlogSpot with specific keywords as below</p> <pre><code>https://www.yourblogname.blogspot.com/feeds/posts/default?q=KEYWORD </code></pre> <p>I have tried to get...
[ { "answer_id": 328455, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>You can modify the list of posts displayed in feed using <a href=\"https://codex.wordpress.org/Plugin_...
2019/02/12
[ "https://wordpress.stackexchange.com/questions/328449", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/159842/" ]
I am able to get articles as RSS feed from below url ``` http://wordpress_site/blog/feed ``` I am also able to get articles from BlogSpot with specific keywords as below ``` https://www.yourblogname.blogspot.com/feeds/posts/default?q=KEYWORD ``` I have tried to get articles from filtering with specific KEYWORD in...
You can modify the list of posts displayed in feed using [`pre_get_posts`](https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts) action. And to target only feeds, you can use [`is_feed`](https://codex.wordpress.org/Function_Reference/is_feed) conditional tag. So such code can look like this: ``` add...
328,459
<p>Is there any documentation showing the names of the Gutenberg block icons within the WordPress docs? </p> <p><a href="https://i.stack.imgur.com/IWsrs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IWsrs.png" alt="Gutenberg block icons"></a></p> <p>To give you some context, I'm using <a href="https://www...
[ { "answer_id": 328461, "author": "moped", "author_id": 160324, "author_profile": "https://wordpress.stackexchange.com/users/160324", "pm_score": 5, "selected": true, "text": "<p>Gutenberg is making use of dashicons. <br />\nYou can find your example icon <a href=\"https://developer.word...
2019/02/12
[ "https://wordpress.stackexchange.com/questions/328459", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37548/" ]
Is there any documentation showing the names of the Gutenberg block icons within the WordPress docs? [![Gutenberg block icons](https://i.stack.imgur.com/IWsrs.png)](https://i.stack.imgur.com/IWsrs.png) To give you some context, I'm using [ACF blocks for Gutenberg](https://www.advancedcustomfields.com/blog/acf-5-8-in...
Gutenberg is making use of dashicons. You can find your example icon [here](https://developer.wordpress.org/resource/dashicons/#admin-comments), and a cheat sheet of dashicons [here](https://developer.wordpress.org/resource/dashicons/).
328,477
<p>I want to be able to hide the 'My account' button when users are logged out and I want to be able to hide the 'Registration' button when users are logged in. </p> <p>How would I go about doing this? I'm still a amatuer at WordPress and I'm still learning, this is what I have so far in my nav-menus.php file.</p> <...
[ { "answer_id": 334411, "author": "Wade John Beckett", "author_id": 116893, "author_profile": "https://wordpress.stackexchange.com/users/116893", "pm_score": 0, "selected": false, "text": "<p>These are the plugins I use most often to show/hide menu items based on user role or weather the ...
2019/02/12
[ "https://wordpress.stackexchange.com/questions/328477", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I want to be able to hide the 'My account' button when users are logged out and I want to be able to hide the 'Registration' button when users are logged in. How would I go about doing this? I'm still a amatuer at WordPress and I'm still learning, this is what I have so far in my nav-menus.php file. ``` if( is_user_...
I should suggest a custom walker to, not that hard at all. starting with: <https://developer.wordpress.org/reference/functions/wp_get_nav_menu_items/> in the foreach loop you are able to check based on title. in this part you will use: <https://developer.wordpress.org/reference/functions/is_user_logged_in/> ``` for...
328,536
<p>Assuming I have no infinite scroll or anything else going on in my theme: Is there a way to enqueue my custom Gutenberg block styles and scripts so they are only (lazy) loaded in the front-end when the block is really used? Something like <code>is_active_widget</code>, just for blocks?</p> <p>If I enqueue them insi...
[ { "answer_id": 328553, "author": "HU is Sebastian", "author_id": 56587, "author_profile": "https://wordpress.stackexchange.com/users/56587", "pm_score": 4, "selected": false, "text": "<p>Well, the styles and scripts you register in your php register_block_type call should only be loaded ...
2019/02/13
[ "https://wordpress.stackexchange.com/questions/328536", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/147050/" ]
Assuming I have no infinite scroll or anything else going on in my theme: Is there a way to enqueue my custom Gutenberg block styles and scripts so they are only (lazy) loaded in the front-end when the block is really used? Something like `is_active_widget`, just for blocks? If I enqueue them inside a `enqueue_block_a...
Thanks @kuchenundkakao for pointing me into the right direction. I'm still answering my own question as I want to give some more context for others that may stumble upon this. So, there are several ways to load your custom blocks, mainly: * `add_action('enqueue_block_assets','xy_function')` / `add_action('enqueue_blo...
328,590
<p>I was trying to redirect my homepage to random blog post in WordPress.</p> <p>My aim is to redirect my viewers to random blog posts whenever they enter into my website. I couldn't find a proper solution, can anyone help me?</p>
[ { "answer_id": 328591, "author": "Sam", "author_id": 37548, "author_profile": "https://wordpress.stackexchange.com/users/37548", "pm_score": 0, "selected": false, "text": "<p>The quickest way to achieve this is to install the <a href=\"https://wordpress.org/plugins/redirect-url-to-post/\...
2019/02/13
[ "https://wordpress.stackexchange.com/questions/328590", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161143/" ]
I was trying to redirect my homepage to random blog post in WordPress. My aim is to redirect my viewers to random blog posts whenever they enter into my website. I couldn't find a proper solution, can anyone help me?
If you don't want to use a plugin. You could put the re-direct directly into your .htaccess (on an apache server): Place this code at the bottom of the .htaccess file: ``` redirect 301 / http://www.example.com/your-post-slug ``` make sure to change the url to the full url of your blog post. If you don't have acces...
328,665
<p>I am tried to display all product category with bellow function .. getting a error Invalid taxonomy .. it's was working fine last 2 installation.. </p> <pre><code> function be_woocommerce_category_id(){ $categories_array = array(); $categories_array[0] = esc_html__('Choose a Category', 'shopstore...
[ { "answer_id": 328591, "author": "Sam", "author_id": 37548, "author_profile": "https://wordpress.stackexchange.com/users/37548", "pm_score": 0, "selected": false, "text": "<p>The quickest way to achieve this is to install the <a href=\"https://wordpress.org/plugins/redirect-url-to-post/\...
2019/02/14
[ "https://wordpress.stackexchange.com/questions/328665", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/83449/" ]
I am tried to display all product category with bellow function .. getting a error Invalid taxonomy .. it's was working fine last 2 installation.. ``` function be_woocommerce_category_id(){ $categories_array = array(); $categories_array[0] = esc_html__('Choose a Category', 'shopstore'); $...
If you don't want to use a plugin. You could put the re-direct directly into your .htaccess (on an apache server): Place this code at the bottom of the .htaccess file: ``` redirect 301 / http://www.example.com/your-post-slug ``` make sure to change the url to the full url of your blog post. If you don't have acces...
328,685
<p>On the taxonomy-{name}.php template for my "Organisation" taxonomy, I am currently showing a limited number of posts, grouped for each term of taxonomy "Format".</p> <p>Where the number of available posts exceeds that which is displayable, I now want to enable AJAX-based loading of more posts.</p> <p>I have follow...
[ { "answer_id": 328760, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": true, "text": "<p>You can use ajax to load more posts on your archive page.</p>\n\n<ol>\n<li>attach a js/jquery click e...
2019/02/14
[ "https://wordpress.stackexchange.com/questions/328685", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/39300/" ]
On the taxonomy-{name}.php template for my "Organisation" taxonomy, I am currently showing a limited number of posts, grouped for each term of taxonomy "Format". Where the number of available posts exceeds that which is displayable, I now want to enable AJAX-based loading of more posts. I have followed countless tuto...
You can use ajax to load more posts on your archive page. 1. attach a js/jquery click event on the More link 2. send ajax request to `admin-ajax.php` (use `wp_localize_script` to get the ajax url to front end) with page number (track this with js variable). 3. handle ajax request in php. Add custom ajax actions with `...
328,721
<p>I have a piece of PHP code to grab my post title which I am putting inside of a PHP element on my page builder.</p> <pre><code>$h4 = get_the_title();`echo '&lt;h4&gt;' . $h4 . '&lt;/h4&gt;';` </code></pre> <p>I want it to be a H1 but want to style the H1 differently to my global H1 settings. I would like this H1 c...
[ { "answer_id": 328722, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 2, "selected": false, "text": "<p>Why not add a CSS class to the H1?</p>\n\n<p><code>echo '&lt;h1 class=\"custom-style\"&gt;' . get_the_tit...
2019/02/14
[ "https://wordpress.stackexchange.com/questions/328721", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/146090/" ]
I have a piece of PHP code to grab my post title which I am putting inside of a PHP element on my page builder. ``` $h4 = get_the_title();`echo '<h4>' . $h4 . '</h4>';` ``` I want it to be a H1 but want to style the H1 differently to my global H1 settings. I would like this H1 centered with font color white and font...
Why not add a CSS class to the H1? `echo '<h1 class="custom-style">' . get_the_title() . '</h1>';` then in your child theme or custom CSS, apply the style to that class: ``` h1.custom-style { text-align:center; color:#fff; font-size:60px; } ```
328,731
<p>I have found the below code to enable viewing the author of a custom post type and it works perfectly for one custom post type. But I need it to work for 4 custom post types called: detox, recipes, movements, lifestyle.</p> <pre><code>function add_author_support_to_posts() { add_post_type_support( 'your_custom_p...
[ { "answer_id": 328734, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 2, "selected": false, "text": "<p><code>wp-config.php</code> includes files, it's not just a config file, and WordPress isn't built to allow p...
2019/02/14
[ "https://wordpress.stackexchange.com/questions/328731", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161243/" ]
I have found the below code to enable viewing the author of a custom post type and it works perfectly for one custom post type. But I need it to work for 4 custom post types called: detox, recipes, movements, lifestyle. ``` function add_author_support_to_posts() { add_post_type_support( 'your_custom_post_type', 'au...
`wp-config.php` includes files, it's not just a config file, and WordPress isn't built to allow putting the file 2 levels up. However, WordPress already supports loading `wp-config.php` from 1 level up. With all of this in mind though, this is only really a protection if you're worried about mis-configuring your serv...
328,747
<p>I accidentally changed my wordpress website url from what it was to the url which is same as my site url and after then I am not able to login into my admin it shows error of page not found(while using my original wordpress site url) and if I try to login through my site url it shows me redirected you too many times...
[ { "answer_id": 328748, "author": "Fabrizio Mele", "author_id": 40463, "author_profile": "https://wordpress.stackexchange.com/users/40463", "pm_score": 0, "selected": false, "text": "<p>I you accidentally changed the site url you can change it back manually, via your database manager (usu...
2019/02/14
[ "https://wordpress.stackexchange.com/questions/328747", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I accidentally changed my wordpress website url from what it was to the url which is same as my site url and after then I am not able to login into my admin it shows error of page not found(while using my original wordpress site url) and if I try to login through my site url it shows me redirected you too many times. ...
If you don't have database access for some reason, you can also use ``` // use these in your wp-config.php define( 'WP_HOME', 'http://example.com' ); define( 'WP_SITEURL', 'http://example.com' ); ``` or ``` // use these in your functions.php update_option( 'siteurl', 'http://example.com' ); update_option( 'home', '...
328,749
<p>I use <code>get_the_content</code> to pass to a javascript variable, and then back to another PHP function. This works great, but there is an issue when using <code>get_the_content</code>. If the post contains only one line (no line breaks) it works great. But if the post contains line breaks I get this error in the...
[ { "answer_id": 328758, "author": "tmdesigned", "author_id": 28273, "author_profile": "https://wordpress.stackexchange.com/users/28273", "pm_score": 1, "selected": false, "text": "<p>It sounds like you are directly echoing the php into a JavaScript variable? get_the_content makes no guara...
2019/02/14
[ "https://wordpress.stackexchange.com/questions/328749", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143279/" ]
I use `get_the_content` to pass to a javascript variable, and then back to another PHP function. This works great, but there is an issue when using `get_the_content`. If the post contains only one line (no line breaks) it works great. But if the post contains line breaks I get this error in the console: `SyntaxError: ...
It sounds like you are directly echoing the php into a JavaScript variable? get\_the\_content makes no guarantees that the value it returns will be sanitized in the right way for a JavaScript variable. You might try first encoding the output into JSON, and then doing that, i.e. ``` <script> <?php ob_start(); ...
328,778
<p>If you see <a href="https://askpuzzle.com/puzzle/what-can-point-in-every-direction-but-can-not-reach-the-destination-by-itself/" rel="nofollow noreferrer">this page</a>, text are aligned left side but I also want them to align centered vertically. Similar to <strong>Middle Align + Left Align</strong> in excel. </p> ...
[ { "answer_id": 328758, "author": "tmdesigned", "author_id": 28273, "author_profile": "https://wordpress.stackexchange.com/users/28273", "pm_score": 1, "selected": false, "text": "<p>It sounds like you are directly echoing the php into a JavaScript variable? get_the_content makes no guara...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328778", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/101334/" ]
If you see [this page](https://askpuzzle.com/puzzle/what-can-point-in-every-direction-but-can-not-reach-the-destination-by-itself/), text are aligned left side but I also want them to align centered vertically. Similar to **Middle Align + Left Align** in excel. You can see this image to see what I am looking for [![e...
It sounds like you are directly echoing the php into a JavaScript variable? get\_the\_content makes no guarantees that the value it returns will be sanitized in the right way for a JavaScript variable. You might try first encoding the output into JSON, and then doing that, i.e. ``` <script> <?php ob_start(); ...
328,785
<p>i would like to create a simple grid. You should get two columns (later more) to put content in there. But not only simple text. All content types should be available</p> <p>My edit function</p> <pre><code>registerBlockType( 'grids-2col', { title: '2 Spalten', icon: icon, category: cate...
[ { "answer_id": 329847, "author": "HU is Sebastian", "author_id": 56587, "author_profile": "https://wordpress.stackexchange.com/users/56587", "pm_score": 2, "selected": false, "text": "<p>You can (at the moment) not use InnerBlocks more than once within a block. However, you can bypass th...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328785", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150475/" ]
i would like to create a simple grid. You should get two columns (later more) to put content in there. But not only simple text. All content types should be available My edit function ``` registerBlockType( 'grids-2col', { title: '2 Spalten', icon: icon, category: category, attribu...
You can (at the moment) not use InnerBlocks more than once within a block. However, you can bypass this by using a template for your InnerBlocks that contain Blocks which support InnerBlocks instead, like the core/column block. Like this: ``` wp.element.createElement(InnerBlocks, { template: [['core/column',{},...
328,793
<p>I'm printing the last modified date via functions.php with the following code</p> <pre><code>function wpb_last_updated_date( $content ) { $u_time = get_the_time('U'); $u_modified_time = get_the_modified_time('U'); if ($u_modified_time &gt;= $u_time + 86400) { $updated_date = get_the_modified_...
[ { "answer_id": 329847, "author": "HU is Sebastian", "author_id": 56587, "author_profile": "https://wordpress.stackexchange.com/users/56587", "pm_score": 2, "selected": false, "text": "<p>You can (at the moment) not use InnerBlocks more than once within a block. However, you can bypass th...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328793", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161294/" ]
I'm printing the last modified date via functions.php with the following code ``` function wpb_last_updated_date( $content ) { $u_time = get_the_time('U'); $u_modified_time = get_the_modified_time('U'); if ($u_modified_time >= $u_time + 86400) { $updated_date = get_the_modified_time('F jS, Y'); ...
You can (at the moment) not use InnerBlocks more than once within a block. However, you can bypass this by using a template for your InnerBlocks that contain Blocks which support InnerBlocks instead, like the core/column block. Like this: ``` wp.element.createElement(InnerBlocks, { template: [['core/column',{},...
328,803
<p>I noticed in my wordpress/woocommerce setup that every time i add a tag to a product or a blog post. It adds that tag as a class into the listed item (Product/blog)</p> <p>I also noticed it adds a class in the same place for every category i put these post items into.</p> <p>How can i prevent wordpress and woocomm...
[ { "answer_id": 329847, "author": "HU is Sebastian", "author_id": 56587, "author_profile": "https://wordpress.stackexchange.com/users/56587", "pm_score": 2, "selected": false, "text": "<p>You can (at the moment) not use InnerBlocks more than once within a block. However, you can bypass th...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328803", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/136343/" ]
I noticed in my wordpress/woocommerce setup that every time i add a tag to a product or a blog post. It adds that tag as a class into the listed item (Product/blog) I also noticed it adds a class in the same place for every category i put these post items into. How can i prevent wordpress and woocommerce from addings...
You can (at the moment) not use InnerBlocks more than once within a block. However, you can bypass this by using a template for your InnerBlocks that contain Blocks which support InnerBlocks instead, like the core/column block. Like this: ``` wp.element.createElement(InnerBlocks, { template: [['core/column',{},...
328,805
<p>Hi everyone I have a question how can you create a dynamic copyright in WordPress with URL that goes back to the home page as well as a URL that goes to the designer of the theme</p>
[ { "answer_id": 328812, "author": "Fabrizio Mele", "author_id": 40463, "author_profile": "https://wordpress.stackexchange.com/users/40463", "pm_score": 1, "selected": false, "text": "<p>The fastest way is to look for the current copyright text inside your theme's <code>footer.php</code> f...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328805", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161300/" ]
Hi everyone I have a question how can you create a dynamic copyright in WordPress with URL that goes back to the home page as well as a URL that goes to the designer of the theme
The fastest way is to look for the current copyright text inside your theme's `footer.php` file and substitute it with something more of your liking. My suggestion, as I don't know what you mean for "dynamic", is to substitute the current text with a function call, like `<?php my_copyright_text() ?>`, and then define ...
328,813
<p>I have a page with with address localhost/ . .In the navigation bar I have a new page link named Blog. SO wheni travel to that page the link is localhost/blog . Now here is my thing ...when i click on any post of that page the next page permalink become localhost/{The-post-name}. what i want is to print the link f...
[ { "answer_id": 328815, "author": "tmdesigned", "author_id": 28273, "author_profile": "https://wordpress.stackexchange.com/users/28273", "pm_score": -1, "selected": false, "text": "<p>You can add a rewrite rule to WordPress:</p>\n\n<pre><code>add_action( 'init', 'wpse_328813_rewrite' );\n...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328813", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161305/" ]
I have a page with with address localhost/ . .In the navigation bar I have a new page link named Blog. SO wheni travel to that page the link is localhost/blog . Now here is my thing ...when i click on any post of that page the next page permalink become localhost/{The-post-name}. what i want is to print the link fully...
Just go to *Settings > Permalinks*, select *Custom Structure* and enter the following: ``` /blog/%postname%/ ``` That will add `/blog/` to the beginning of post names in their permalinks. This will not affect Pages.
328,830
<p>I have a website where the home page is created in CodeIgniter (www.myweb.com) and the blogs are created in WordPress as a subdirectory (blog.myweb.com) and is hosted in AWS. I am trying to update the plugins and WordPress core but after I give FTP credentials, the error is <strong>Unable to locate WordPress content...
[ { "answer_id": 328845, "author": "Arvind Singh", "author_id": 113501, "author_profile": "https://wordpress.stackexchange.com/users/113501", "pm_score": 1, "selected": false, "text": "<ul>\n<li>All files should be owned by the actual user's account, not the user account used for the httpd...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328830", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130682/" ]
I have a website where the home page is created in CodeIgniter (www.myweb.com) and the blogs are created in WordPress as a subdirectory (blog.myweb.com) and is hosted in AWS. I am trying to update the plugins and WordPress core but after I give FTP credentials, the error is **Unable to locate WordPress content director...
* All files should be owned by the actual user's account, not the user account used for the httpd process. * Group ownership is irrelevant unless there are specific group requirements for the web-server process permissions checking. This is not usually the case. * All directories should be 755 or 750. * All files shoul...
328,837
<p>This code works really well. It displays the title of the post randomly with permalink but my objective is to display the thumbnail and/or featured image instead.</p> <p>Any help would be appreciated.<a href="https://i.stack.imgur.com/0jlkE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0jlkE.jp...
[ { "answer_id": 328845, "author": "Arvind Singh", "author_id": 113501, "author_profile": "https://wordpress.stackexchange.com/users/113501", "pm_score": 1, "selected": false, "text": "<ul>\n<li>All files should be owned by the actual user's account, not the user account used for the httpd...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328837", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161323/" ]
This code works really well. It displays the title of the post randomly with permalink but my objective is to display the thumbnail and/or featured image instead. Any help would be appreciated.[![enter image description here](https://i.stack.imgur.com/0jlkE.jpg)](https://i.stack.imgur.com/0jlkE.jpg) ``` <?php functio...
* All files should be owned by the actual user's account, not the user account used for the httpd process. * Group ownership is irrelevant unless there are specific group requirements for the web-server process permissions checking. This is not usually the case. * All directories should be 755 or 750. * All files shoul...
328,844
<p>I want to convert my navigation menu into WordPress. tried with lots of snippets. But something I am missing. </p> <p>Here is my menu example html: </p> <p><code>&lt;div class="menu"&gt; &lt;a class="some-class" href="#"&gt;menu1&lt;/a&gt; &lt;a class="some-class" href="#"&gt;menu2&lt;/a&gt; &lt;a class="som...
[ { "answer_id": 328870, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>You need the current object id and compare it to the menu item id, I think. Maybe something like thi...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328844", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20831/" ]
I want to convert my navigation menu into WordPress. tried with lots of snippets. But something I am missing. Here is my menu example html: `<div class="menu"> <a class="some-class" href="#">menu1</a> <a class="some-class" href="#">menu2</a> <a class="some-class" href="#">menu3</a> <a class="some-class is-activ...
You don't need to write a custom walker to achieve this. You can modify the output of the `wp_nav_menu()` function and hook into the appropriate default nav menu filter to modify the output of the individual menu items. E.g. (assuming your theme menu location is called primary) Put this in your functions.php file ```...
328,849
<p>Working on Wordpress / Woocommerce architecture, I'm new in woocommerce, before i've worked on django and laravel framework, the project is a plugin wp, where a little form is fit with select tags for give me back some products by their sku. I can get the products objects, but I can't override the wp_query returned...
[ { "answer_id": 328870, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>You need the current object id and compare it to the menu item id, I think. Maybe something like thi...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328849", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161218/" ]
Working on Wordpress / Woocommerce architecture, I'm new in woocommerce, before i've worked on django and laravel framework, the project is a plugin wp, where a little form is fit with select tags for give me back some products by their sku. I can get the products objects, but I can't override the wp\_query returned by...
You don't need to write a custom walker to achieve this. You can modify the output of the `wp_nav_menu()` function and hook into the appropriate default nav menu filter to modify the output of the individual menu items. E.g. (assuming your theme menu location is called primary) Put this in your functions.php file ```...
328,850
<p>I got this error message when trying to upload EPS-files to my WordPress Media Library:</p> <blockquote> <p>Sorry, this file type is not permitted for security reasons</p> </blockquote> <p>So I added this snippet to my functions.php</p> <pre><code>add_filter( 'upload_mimes', function ( $mime_types ) { $mime...
[ { "answer_id": 329362, "author": "Tomas Eklund", "author_id": 125005, "author_profile": "https://wordpress.stackexchange.com/users/125005", "pm_score": 4, "selected": true, "text": "<p>In recent versions of WordPress (<a href=\"https://make.wordpress.org/core/2018/12/13/backwards-compati...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328850", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/125005/" ]
I got this error message when trying to upload EPS-files to my WordPress Media Library: > > Sorry, this file type is not permitted for security reasons > > > So I added this snippet to my functions.php ``` add_filter( 'upload_mimes', function ( $mime_types ) { $mime_types[ 'eps' ] = 'application/postscript';...
In recent versions of WordPress ([5.0.1](https://make.wordpress.org/core/2018/12/13/backwards-compatibility-breaks-in-5-0-1/) or higher) file upload security has been tightened by actually checking the content of an uploaded file using the PHP function [finfo\_file()](http://php.net/manual/en/function.finfo-file.php) t...
328,852
<p>I have this piece of code and, although it works, I do not understand how. First, I created a custom post type into my mu-plugins folder:</p> <pre><code>function actor_init() { $args = array( 'label' =&gt; 'actors', 'description' =&gt; 'hollywood &amp; stuff', 'supports' =&gt; array( 'thumbnail...
[ { "answer_id": 329362, "author": "Tomas Eklund", "author_id": 125005, "author_profile": "https://wordpress.stackexchange.com/users/125005", "pm_score": 4, "selected": true, "text": "<p>In recent versions of WordPress (<a href=\"https://make.wordpress.org/core/2018/12/13/backwards-compati...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328852", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/158939/" ]
I have this piece of code and, although it works, I do not understand how. First, I created a custom post type into my mu-plugins folder: ``` function actor_init() { $args = array( 'label' => 'actors', 'description' => 'hollywood & stuff', 'supports' => array( 'thumbnail', 'title', ...
In recent versions of WordPress ([5.0.1](https://make.wordpress.org/core/2018/12/13/backwards-compatibility-breaks-in-5-0-1/) or higher) file upload security has been tightened by actually checking the content of an uploaded file using the PHP function [finfo\_file()](http://php.net/manual/en/function.finfo-file.php) t...
328,862
<p>I try to implement a function to notify users about changes on the webpage. I tried to use sessions for that but it did not work very well. For example:</p> <p>A User can attend an event. To do that he has to register for it. So the status of his registration is 'on hold' at that moment. In the backend, i can accep...
[ { "answer_id": 328863, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>Are the registrations saved as custom posts in the database? </p>\n\n<p>If so, perhaps you could hav...
2019/02/15
[ "https://wordpress.stackexchange.com/questions/328862", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161342/" ]
I try to implement a function to notify users about changes on the webpage. I tried to use sessions for that but it did not work very well. For example: A User can attend an event. To do that he has to register for it. So the status of his registration is 'on hold' at that moment. In the backend, i can accept his regi...
PHP only runs when you request a page. When the request is over, everything is gone. It's not like a Node application where the same program handles all the requests and variables can persist across pages just by defining them, so doing things with a `$wp_session` variable will only do things on that request. If you n...
328,914
<p>I have added the custom Gutenberg block for my shortcode, but in checkbox control check uncheck does not work, please check code done as below:</p> <pre><code>el( components.CheckboxControl, { label: i18n.__( 'Display it?', 'txt-domain' ), checked: props.attributes.myAttr, onChange: function( val ) { ...
[ { "answer_id": 328863, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>Are the registrations saved as custom posts in the database? </p>\n\n<p>If so, perhaps you could hav...
2019/02/16
[ "https://wordpress.stackexchange.com/questions/328914", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/123295/" ]
I have added the custom Gutenberg block for my shortcode, but in checkbox control check uncheck does not work, please check code done as below: ``` el( components.CheckboxControl, { label: i18n.__( 'Display it?', 'txt-domain' ), checked: props.attributes.myAttr, onChange: function( val ) { if( val ...
PHP only runs when you request a page. When the request is over, everything is gone. It's not like a Node application where the same program handles all the requests and variables can persist across pages just by defining them, so doing things with a `$wp_session` variable will only do things on that request. If you n...
328,934
<p>I moved my WordPress installations from my old server to a new one. I copied all databases..etc and things seem to be working fine. (I have already migrated servers before, so I guess I know how to do the migration part correctly). However I only have one problem with ALL my wp installations, when adding new items t...
[ { "answer_id": 328863, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>Are the registrations saved as custom posts in the database? </p>\n\n<p>If so, perhaps you could hav...
2019/02/16
[ "https://wordpress.stackexchange.com/questions/328934", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/153834/" ]
I moved my WordPress installations from my old server to a new one. I copied all databases..etc and things seem to be working fine. (I have already migrated servers before, so I guess I know how to do the migration part correctly). However I only have one problem with ALL my wp installations, when adding new items to n...
PHP only runs when you request a page. When the request is over, everything is gone. It's not like a Node application where the same program handles all the requests and variables can persist across pages just by defining them, so doing things with a `$wp_session` variable will only do things on that request. If you n...
328,964
<p>I want to remove the JS I added and gets versioned by wp. I have a js script called base.js, and wordpress loads that by itself like</p> <pre><code>&lt;script type="text/javascript" src="../base.js?ver=4.9.9"&gt;&lt;/script&gt; </code></pre> <p>this code removes the version number </p> <pre><code>function remove_...
[ { "answer_id": 328969, "author": "Brada", "author_id": 161366, "author_profile": "https://wordpress.stackexchange.com/users/161366", "pm_score": 2, "selected": false, "text": "<p>If I'm reading correctly you just want to deregister a script but failed... I think that you tried to deregis...
2019/02/17
[ "https://wordpress.stackexchange.com/questions/328964", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/159409/" ]
I want to remove the JS I added and gets versioned by wp. I have a js script called base.js, and wordpress loads that by itself like ``` <script type="text/javascript" src="../base.js?ver=4.9.9"></script> ``` this code removes the version number ``` function remove_cssjs_ver( $src ) { if( strpos( $src, '?ver='...
If I'm reading correctly you just want to deregister a script but failed... I think that you tried to deregister it too early( before was added ). ``` add_action( 'wp_print_scripts', 'example' ); function example() { wp_dequeue_script( 'name_of_script' ); } ``` By calling the function in 'wp\_print\_scripts' shou...
328,967
<p>Wife transferred her domain from Godaddy to HostGator. Somehow the Post page is still linked to the old site. I say old site because she started fresh on the site only wanting the domain. Her domain was hersite.wordpress.com and now is just hersite.com. </p> <p>All the content is where it should be until I assign ...
[ { "answer_id": 328969, "author": "Brada", "author_id": 161366, "author_profile": "https://wordpress.stackexchange.com/users/161366", "pm_score": 2, "selected": false, "text": "<p>If I'm reading correctly you just want to deregister a script but failed... I think that you tried to deregis...
2019/02/17
[ "https://wordpress.stackexchange.com/questions/328967", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161405/" ]
Wife transferred her domain from Godaddy to HostGator. Somehow the Post page is still linked to the old site. I say old site because she started fresh on the site only wanting the domain. Her domain was hersite.wordpress.com and now is just hersite.com. All the content is where it should be until I assign the post pa...
If I'm reading correctly you just want to deregister a script but failed... I think that you tried to deregister it too early( before was added ). ``` add_action( 'wp_print_scripts', 'example' ); function example() { wp_dequeue_script( 'name_of_script' ); } ``` By calling the function in 'wp\_print\_scripts' shou...
328,978
<p>I want to get the wp_editor (tinymce) content then find a sentence by specific word with regex. However, have no idea how to get the content</p> <p>When a post is published or updated, the function will get the content and then find a sentence by the specific word.</p> <p>My regex to get a whole sentence:</p> <pr...
[ { "answer_id": 328969, "author": "Brada", "author_id": 161366, "author_profile": "https://wordpress.stackexchange.com/users/161366", "pm_score": 2, "selected": false, "text": "<p>If I'm reading correctly you just want to deregister a script but failed... I think that you tried to deregis...
2019/02/17
[ "https://wordpress.stackexchange.com/questions/328978", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/149809/" ]
I want to get the wp\_editor (tinymce) content then find a sentence by specific word with regex. However, have no idea how to get the content When a post is published or updated, the function will get the content and then find a sentence by the specific word. My regex to get a whole sentence: ``` $regex = '/<p>Chapt...
If I'm reading correctly you just want to deregister a script but failed... I think that you tried to deregister it too early( before was added ). ``` add_action( 'wp_print_scripts', 'example' ); function example() { wp_dequeue_script( 'name_of_script' ); } ``` By calling the function in 'wp\_print\_scripts' shou...
328,986
<p>Users can upload an avatar as a local image file on my website. If they didn't do so, it will fall back to the WordPress default (Gravatar). But I want any occurrence of Gravatar to be replaced with a locally stored placeholder image.</p>
[ { "answer_id": 328988, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>OK, so there are some occurrences of <code>get_avatar()</code> in your site. If you'll take a look at ...
2019/02/17
[ "https://wordpress.stackexchange.com/questions/328986", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133010/" ]
Users can upload an avatar as a local image file on my website. If they didn't do so, it will fall back to the WordPress default (Gravatar). But I want any occurrence of Gravatar to be replaced with a locally stored placeholder image.
OK, so there are some occurrences of `get_avatar()` in your site. If you'll take a look at docs for this function, you'll see, that: * you pass URL for default avatar image as 3rd param, * you pass `args` as 5th param. And one of these `args` is: > > **force\_default** (bool) (optional) Whether to always show the d...
328,990
<p>I have two drop downs. The first one contains list of parent taxonomies from a custom post type. And the second one contains all the sub-taxonomies at a time. But I'm trying to display only those sub-taxonomies of <strong>selected</strong> parent taxonomy (not all the sub-taxonomies from other parent taxonomies). Fo...
[ { "answer_id": 328992, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 1, "selected": false, "text": "<p>You could achieve that by using js / jQuery. There might be more ways to it, but two comes into my m...
2019/02/17
[ "https://wordpress.stackexchange.com/questions/328990", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/113702/" ]
I have two drop downs. The first one contains list of parent taxonomies from a custom post type. And the second one contains all the sub-taxonomies at a time. But I'm trying to display only those sub-taxonomies of **selected** parent taxonomy (not all the sub-taxonomies from other parent taxonomies). For example, if I ...
Here's a fully functional snippet for doing this. * I added the correct WordPress table stylings * This requires adding my `smyles_get_taxonomy_hierarchy` to add children of taxonomy to the term object * This hides the child dropdown if no children exist * This handles everything (and saves) based on `TERM ID` not the...
329,007
<p>I am trying to build an Custom Post Type for showing information about events. The Custom Post Type has name 'Event', with the following meta fields: </p> <ul> <li>event_startdate <em>(date in format YYYY-MM-DD)</em></li> <li>event_enddate <em>(date in format YYYY-MM-DD)</em></li> </ul> <p>This works fine for the ...
[ { "answer_id": 329012, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>OK, so this problem has two parts:</p>\n\n<ol>\n<li>Make WordPress to sort these posts properly.</li>\...
2019/02/17
[ "https://wordpress.stackexchange.com/questions/329007", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/107055/" ]
I am trying to build an Custom Post Type for showing information about events. The Custom Post Type has name 'Event', with the following meta fields: * event\_startdate *(date in format YYYY-MM-DD)* * event\_enddate *(date in format YYYY-MM-DD)* This works fine for the single-event listing, however in the archive li...
OK, so this problem has two parts: 1. Make WordPress to sort these posts properly. 2. Make WordPress to display them with all that grouping. 1. Sorting CPT by meta value on archive --------------------------------------- You can use `pre_get_posts` to achieve this. ``` add_action( 'pre_get_posts', function ( $quer...
329,009
<p>I am trying to create a basic plugin to send user details to a CRM when a user signs up on the WordPress website as a basic subscriber.</p> <p>I have reached a sticking point, I have tried to interpret the API details as best as I can, but I am unsure, if I am formatting my body data properly as it just isn't worki...
[ { "answer_id": 329010, "author": "sMyles", "author_id": 51201, "author_profile": "https://wordpress.stackexchange.com/users/51201", "pm_score": 2, "selected": false, "text": "<p>I recommend only setting the arguments you absolutely need to change from defaults, to eliminate potential iss...
2019/02/17
[ "https://wordpress.stackexchange.com/questions/329009", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161436/" ]
I am trying to create a basic plugin to send user details to a CRM when a user signs up on the WordPress website as a basic subscriber. I have reached a sticking point, I have tried to interpret the API details as best as I can, but I am unsure, if I am formatting my body data properly as it just isn't working. I can...
I recommend only setting the arguments you absolutely need to change from defaults, to eliminate potential issues while testing. It's best to only add additional arguments as they are needed. All arguments can be found here: <https://developer.wordpress.org/reference/classes/WP_Http/request/> If possible also remove ...
329,033
<p>Every time I select a featured photo for a single post, the size is always adjusted and it's massive. I have changed the size of the photo within WordPress, outside of WordPress, added code to functions, added widgets and still cannot seem to change the picture size. I may need hands on help as I have followed most ...
[ { "answer_id": 329010, "author": "sMyles", "author_id": 51201, "author_profile": "https://wordpress.stackexchange.com/users/51201", "pm_score": 2, "selected": false, "text": "<p>I recommend only setting the arguments you absolutely need to change from defaults, to eliminate potential iss...
2019/02/18
[ "https://wordpress.stackexchange.com/questions/329033", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161456/" ]
Every time I select a featured photo for a single post, the size is always adjusted and it's massive. I have changed the size of the photo within WordPress, outside of WordPress, added code to functions, added widgets and still cannot seem to change the picture size. I may need hands on help as I have followed most vid...
I recommend only setting the arguments you absolutely need to change from defaults, to eliminate potential issues while testing. It's best to only add additional arguments as they are needed. All arguments can be found here: <https://developer.wordpress.org/reference/classes/WP_Http/request/> If possible also remove ...
329,034
<p>Display featured image file size, extension, filename, type, orientation? How to display some information of featured image in post.</p> <p>I need to display like this in post:</p> <p>Detail Of Easter Desktop Wallpaper Widescreen Posted : February 13, 2017 At 9:46 Am</p> <p>Author : Admin</p> <p>Category : Easte...
[ { "answer_id": 329036, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 1, "selected": false, "text": "<p>The featured image is just an attachment, and you can retrieve its post ID via <code>get_post_thumbnail_id</...
2019/02/18
[ "https://wordpress.stackexchange.com/questions/329034", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161455/" ]
Display featured image file size, extension, filename, type, orientation? How to display some information of featured image in post. I need to display like this in post: Detail Of Easter Desktop Wallpaper Widescreen Posted : February 13, 2017 At 9:46 Am Author : Admin Category : Easter Tags : Beautiful, Cool, Desk...
The featured image is just an attachment, and you can retrieve its post ID via `get_post_thumbnail_id`, e.g. ``` $featured_image_id = get_post_thumbnail_id( $post ); ``` At which point you're dealing with a standard post of type `attachment`. Other than checking that there is a featured image, no special handling is...
329,038
<p><strong>My goal is to be able to call a plugin function per site and of course it has different result based on the site data.</strong> </p> <p>e.g.</p> <p>I have a plugin called: <strong>sample-plugin.php</strong></p> <p>Inside it has a function called:</p> <pre><code>function sp_echo_site() { echo get_site_...
[ { "answer_id": 329046, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": true, "text": "<p>You're almost there... </p>\n\n<p>If you have this in your plugin:</p>\n\n<pre><code>function sp_echo_...
2019/02/18
[ "https://wordpress.stackexchange.com/questions/329038", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161460/" ]
**My goal is to be able to call a plugin function per site and of course it has different result based on the site data.** e.g. I have a plugin called: **sample-plugin.php** Inside it has a function called: ``` function sp_echo_site() { echo get_site_url(); } ``` I have a multisite inside has 3 sites: e.g. an...
You're almost there... If you have this in your plugin: ``` function sp_echo_site() { echo get_site_url(); } ``` Then you call this function as this: ``` sp_echo_site(); ``` And this line will run this function in the context of current site. So you'll have to do something like this: ``` if ( function_exis...
329,089
<p>Quick heads up, I know nothing much about php so I might need some extra help with this. So, I have set up a while ago a child theme for Astra in Wordpress. And while everything is working well so far, I just noticed that the customizer preview page is not working, or rather not fully loading at all.</p> <p>I went ...
[ { "answer_id": 329046, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": true, "text": "<p>You're almost there... </p>\n\n<p>If you have this in your plugin:</p>\n\n<pre><code>function sp_echo_...
2019/02/18
[ "https://wordpress.stackexchange.com/questions/329089", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161486/" ]
Quick heads up, I know nothing much about php so I might need some extra help with this. So, I have set up a while ago a child theme for Astra in Wordpress. And while everything is working well so far, I just noticed that the customizer preview page is not working, or rather not fully loading at all. I went through th...
You're almost there... If you have this in your plugin: ``` function sp_echo_site() { echo get_site_url(); } ``` Then you call this function as this: ``` sp_echo_site(); ``` And this line will run this function in the context of current site. So you'll have to do something like this: ``` if ( function_exis...
329,115
<p>I'm getting this error when loading my page. I have 5.0.3 of WordPress. </p> <blockquote> <p>Uncaught SyntaxError: missing ) after argument list<br> :formatted:1845</p> </blockquote> <p>The link redirect to this code:</p> <pre><code>&lt;script type='text/javascript'&gt;( 'fetch' in window ) || document.write(...
[ { "answer_id": 329046, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": true, "text": "<p>You're almost there... </p>\n\n<p>If you have this in your plugin:</p>\n\n<pre><code>function sp_echo_...
2019/02/18
[ "https://wordpress.stackexchange.com/questions/329115", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161498/" ]
I'm getting this error when loading my page. I have 5.0.3 of WordPress. > > Uncaught SyntaxError: missing ) after argument list > > :formatted:1845 > > > The link redirect to this code: ``` <script type='text/javascript'>( 'fetch' in window ) || document.write( '<script src="https://learn.blueworkforce.com/...
You're almost there... If you have this in your plugin: ``` function sp_echo_site() { echo get_site_url(); } ``` Then you call this function as this: ``` sp_echo_site(); ``` And this line will run this function in the context of current site. So you'll have to do something like this: ``` if ( function_exis...
329,122
<p>I registered a Taxonomy for a custom post type called events. </p> <pre><code>// Register Custom Taxonomy function events_categories() { $labels = array( 'name' =&gt; _x( 'events_categories', 'Taxonomy General Name', 'text_domain' ), 'singular_name' =&gt; _x( ...
[ { "answer_id": 329046, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": true, "text": "<p>You're almost there... </p>\n\n<p>If you have this in your plugin:</p>\n\n<pre><code>function sp_echo_...
2019/02/18
[ "https://wordpress.stackexchange.com/questions/329122", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/154739/" ]
I registered a Taxonomy for a custom post type called events. ``` // Register Custom Taxonomy function events_categories() { $labels = array( 'name' => _x( 'events_categories', 'Taxonomy General Name', 'text_domain' ), 'singular_name' => _x( 'events_category', '...
You're almost there... If you have this in your plugin: ``` function sp_echo_site() { echo get_site_url(); } ``` Then you call this function as this: ``` sp_echo_site(); ``` And this line will run this function in the context of current site. So you'll have to do something like this: ``` if ( function_exis...
329,126
<p>we try to connect our Managment Software to Wordpress / Woocommerce.</p> <p>Our customers can edit and manage product, stock and category directly from our sofware.</p> <p>Wordpress Database is simply so we easly reach our goal.</p> <p>The only problem left is the "Image Management".</p> <p>Our main problem si t...
[ { "answer_id": 329046, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 2, "selected": true, "text": "<p>You're almost there... </p>\n\n<p>If you have this in your plugin:</p>\n\n<pre><code>function sp_echo_...
2019/02/18
[ "https://wordpress.stackexchange.com/questions/329126", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161504/" ]
we try to connect our Managment Software to Wordpress / Woocommerce. Our customers can edit and manage product, stock and category directly from our sofware. Wordpress Database is simply so we easly reach our goal. The only problem left is the "Image Management". Our main problem si the wp\_attachment\_metadata: `...
You're almost there... If you have this in your plugin: ``` function sp_echo_site() { echo get_site_url(); } ``` Then you call this function as this: ``` sp_echo_site(); ``` And this line will run this function in the context of current site. So you'll have to do something like this: ``` if ( function_exis...
329,130
<p>I am attempting to load a page template into a shortcode so I can easily load the content wherever I want.</p> <p>I have done some research and many people have said this code has worked for them but for some reason this does not seem to load my template right as I just get a blank page.</p> <p>I know the shortcod...
[ { "answer_id": 329131, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p><a href=\"https://developer.wordpress.org/reference/functions/get_template_part/\" rel=\"nofollow nore...
2019/02/18
[ "https://wordpress.stackexchange.com/questions/329130", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161506/" ]
I am attempting to load a page template into a shortcode so I can easily load the content wherever I want. I have done some research and many people have said this code has worked for them but for some reason this does not seem to load my template right as I just get a blank page. I know the shortcode is executing as...
[`get_template_part`](https://developer.wordpress.org/reference/functions/get_template_part/) takes slug as first parameter and not filename. So it should be: ``` get_template_part( 'template-sponsors' ); ``` And with more details... This function takes two parameters: get\_template\_part( string $slug, string $na...
329,135
<p>I am designing a website using the <a href="https://www.thinkupthemes.com/free/renden-free/" rel="nofollow noreferrer">Renden Free theme</a>, and my problem is that some long titles, when viewed in mobile, have words broken in half. For example:</p> <p><a href="https://i.stack.imgur.com/k3sT9.jpg" rel="nofollow nor...
[ { "answer_id": 329172, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 3, "selected": true, "text": "<p>It's possible that a word-break CSS rule could fix the problem. You could apply it globally with this</...
2019/02/18
[ "https://wordpress.stackexchange.com/questions/329135", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25139/" ]
I am designing a website using the [Renden Free theme](https://www.thinkupthemes.com/free/renden-free/), and my problem is that some long titles, when viewed in mobile, have words broken in half. For example: [![Screenshot](https://i.stack.imgur.com/k3sT9.jpg)](https://i.stack.imgur.com/k3sT9.jpg) As you can see, the...
It's possible that a word-break CSS rule could fix the problem. You could apply it globally with this ``` body {word-break:normal !important; } ``` Or maybe this: ``` body {overflow-wrap: normal;} ``` But it might be better to apply that to the specific class/id used by the title. And ever further tweak it to onl...
329,366
<p>I want to make it so that when an image is added to a post, full size is selected by default. It currently defaults to large. </p> <p>I have tried:</p> <pre><code>function my_set_default_image_size () { return 'full'; } add_filter( 'pre_option_image_default_size', 'my_set_default_image_size' ); </code></pre>...
[ { "answer_id": 329206, "author": "Jason Is My Name", "author_id": 159876, "author_profile": "https://wordpress.stackexchange.com/users/159876", "pm_score": 1, "selected": false, "text": "<p>It must be in the included in the code somewhere. Most search forms will have a search.php or some...
2019/02/20
[ "https://wordpress.stackexchange.com/questions/329366", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/140502/" ]
I want to make it so that when an image is added to a post, full size is selected by default. It currently defaults to large. I have tried: ``` function my_set_default_image_size () { return 'full'; } add_filter( 'pre_option_image_default_size', 'my_set_default_image_size' ); ``` and ``` add_filter('pre_opti...
It must be in the included in the code somewhere. Most search forms will have a search.php or some other variation of that name if it is a custom search (located in the root of your theme). \*\*EDIT: \*\* off the back of our short conversation below. You have used WooCommerce to arrange your products. This means you ...
329,382
<p>I have a custom post type movies that I have defined in function.php</p> <pre><code>function create_post_type() { register_post_type( 'movies', array( 'supports' =&gt; array('title', 'editor' , 'excerpt' , 'custom-fields'), 'labels' =&gt; array( 'taxonomies' =&gt; 'mvgen', 'name' =&gt; __( 'movie...
[ { "answer_id": 329206, "author": "Jason Is My Name", "author_id": 159876, "author_profile": "https://wordpress.stackexchange.com/users/159876", "pm_score": 1, "selected": false, "text": "<p>It must be in the included in the code somewhere. Most search forms will have a search.php or some...
2019/02/20
[ "https://wordpress.stackexchange.com/questions/329382", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161305/" ]
I have a custom post type movies that I have defined in function.php ``` function create_post_type() { register_post_type( 'movies', array( 'supports' => array('title', 'editor' , 'excerpt' , 'custom-fields'), 'labels' => array( 'taxonomies' => 'mvgen', 'name' => __( 'movies' ), 'singular_name...
It must be in the included in the code somewhere. Most search forms will have a search.php or some other variation of that name if it is a custom search (located in the root of your theme). \*\*EDIT: \*\* off the back of our short conversation below. You have used WooCommerce to arrange your products. This means you ...
329,452
<p>I have a problem with an old theme that can't be updated. My hosts (1&amp;1) are now charging to continue using PHP 5.6 but I get the following errors when switching to PHP 7.2 and I don't know what to do. If anyone can help, it would be much appreciated. Thanks in advance.</p> <pre><code>Warning: Declaration of my...
[ { "answer_id": 329467, "author": "itsdanprice", "author_id": 14247, "author_profile": "https://wordpress.stackexchange.com/users/14247", "pm_score": 1, "selected": false, "text": "<p>This can be tricky to help with without some more details.</p>\n\n<p>Sounds like PHP 7 has run into some ...
2019/02/21
[ "https://wordpress.stackexchange.com/questions/329452", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161740/" ]
I have a problem with an old theme that can't be updated. My hosts (1&1) are now charging to continue using PHP 5.6 but I get the following errors when switching to PHP 7.2 and I don't know what to do. If anyone can help, it would be much appreciated. Thanks in advance. ``` Warning: Declaration of mysiteDescriptionWal...
This can be tricky to help with without some more details. Sounds like PHP 7 has run into some compatibility errors. Seems that you need to look at line 87 of /homepages/36/d129703868/htdocs/mightyoak/bhd-wp/wp-content/themes/construct/lib/classes/menu-walker.php Is this the Construct Theme and are you running the l...
329,457
<p>When using Gutenberg I would like to disable all users except administrator from being able to edit a post's title even though I want to allow them to edit the post, <strong>and</strong> I would like to disable the permalink editor that pops-up just above the post title.</p> <p>I want to do this for a custom post t...
[ { "answer_id": 329697, "author": "Jon Masterson", "author_id": 26745, "author_profile": "https://wordpress.stackexchange.com/users/26745", "pm_score": 1, "selected": false, "text": "<p>I used this, inline, on specific pages (using get_current_screen()). I'd hoped this would enable me to ...
2019/02/21
[ "https://wordpress.stackexchange.com/questions/329457", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89/" ]
When using Gutenberg I would like to disable all users except administrator from being able to edit a post's title even though I want to allow them to edit the post, **and** I would like to disable the permalink editor that pops-up just above the post title. I want to do this for a custom post type where we will disab...
I used this, inline, on specific pages (using get\_current\_screen()). I'd hoped this would enable me to hide/show the permalink panel under certain conditions. However, removeEditorPanel() removes the permalink panel globally. This isn't completely horrifying, since the css still works conditionally, and the permalink...
329,506
<p>I write messages into my db table with jQuery Ajax form post like this:</p> <p><strong>functions.php</strong></p> <pre><code>add_action('wp_ajax_send_projectmessage', 'send_projectmessage'); function send_projectmessage() { global $wpdb; $wpdb-&gt;insert( //insert stuff to db table)); wp_send_json_suc...
[ { "answer_id": 329508, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 0, "selected": false, "text": "<p>You can use <code>wp_send_json_success</code> to send messages back to the jQuery. The function acce...
2019/02/21
[ "https://wordpress.stackexchange.com/questions/329506", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64243/" ]
I write messages into my db table with jQuery Ajax form post like this: **functions.php** ``` add_action('wp_ajax_send_projectmessage', 'send_projectmessage'); function send_projectmessage() { global $wpdb; $wpdb->insert( //insert stuff to db table)); wp_send_json_success(); } ``` **JS:** ``` $('#...
Modify your code as follows: ``` add_action('wp_ajax_send_projectmessage', 'send_projectmessage'); function send_projectmessage() { global $wpdb; $wpdb->insert( //insert stuff to db table)); // Call your function to retrieve your data and send it to browser $messages = load_projectmessages($projectid)...
329,510
<p>I am using the following code:</p> <pre><code>function seconddb() { global $seconddb; $seconddb = new wpdb('username','password','g3boat5_G3_Genba','localhost'); } add_action('init','seconddb'); // add the shortcode [pontoon-table], tell WP which function to call add_shortcode( 'pontoon-table', 'pontoon_tab...
[ { "answer_id": 329512, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>It's not displayed as table, because you don't return correct HTML code. Let's take a look at your cod...
2019/02/21
[ "https://wordpress.stackexchange.com/questions/329510", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161689/" ]
I am using the following code: ``` function seconddb() { global $seconddb; $seconddb = new wpdb('username','password','g3boat5_G3_Genba','localhost'); } add_action('init','seconddb'); // add the shortcode [pontoon-table], tell WP which function to call add_shortcode( 'pontoon-table', 'pontoon_table_shortcode' ...
It's not displayed as table, because you don't return correct HTML code. Let's take a look at your code (I've put comments at end of incorrect lines): ``` $content = '<table>'; $content .= '</tr><th>Week Beginning</th><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th><th>Saturday</th><th...
329,534
<p>So I have two code snippets, trying to get the child pages of the current page. The current page is "Sample", and the following code lives in page-sample.php.</p> <p>The first snippet uses get_posts()</p> <pre><code>$args = array( 'post_parent' =&gt; $post-&gt;ID, 'post_type' =&gt...
[ { "answer_id": 329538, "author": "hamdirizal", "author_id": 133145, "author_profile": "https://wordpress.stackexchange.com/users/133145", "pm_score": -1, "selected": false, "text": "<p>In your WP_Query code instead of</p>\n\n<pre><code>echo $post-&gt;post_title; \n</code></pre>\n\n<p...
2019/02/21
[ "https://wordpress.stackexchange.com/questions/329534", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161799/" ]
So I have two code snippets, trying to get the child pages of the current page. The current page is "Sample", and the following code lives in page-sample.php. The first snippet uses get\_posts() ``` $args = array( 'post_parent' => $post->ID, 'post_type' => 'page', 'p...
You are missing a `$` before args in ``` $child_pages_query= new WP_Query(args); ``` It should be ``` $child_pages_query= new WP_Query($args); ```
329,603
<p>I know how to do it with apache/mod_proxy, but I can't use mod_proxy on our shared host. So no .htaccess solutions.</p> <p>Currently I have the following code in child theme's page.php</p> <pre><code>global $post ; if( needs_replacement( $post ) ) { $post_name = $post-&gt;post_name ; $from_url = create_url( $p...
[ { "answer_id": 329538, "author": "hamdirizal", "author_id": 133145, "author_profile": "https://wordpress.stackexchange.com/users/133145", "pm_score": -1, "selected": false, "text": "<p>In your WP_Query code instead of</p>\n\n<pre><code>echo $post-&gt;post_title; \n</code></pre>\n\n<p...
2019/02/22
[ "https://wordpress.stackexchange.com/questions/329603", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13215/" ]
I know how to do it with apache/mod\_proxy, but I can't use mod\_proxy on our shared host. So no .htaccess solutions. Currently I have the following code in child theme's page.php ``` global $post ; if( needs_replacement( $post ) ) { $post_name = $post->post_name ; $from_url = create_url( $post ); $r = wp_remot...
You are missing a `$` before args in ``` $child_pages_query= new WP_Query(args); ``` It should be ``` $child_pages_query= new WP_Query($args); ```
329,629
<p>I have this:</p> <p>PHP:</p> <pre><code>add_action('wp_ajax_count_messages', 'count_messages'); function count_messages($projectid) { //some code wp_send_json_success($projectid); } </code></pre> <p>JS:</p> <pre><code>var countData = { 'action': 'count_messages', 'projectid': '100' } var myReques...
[ { "answer_id": 329630, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 1, "selected": true, "text": "<p>The data you send from jQuey to PHP is in the <code>$_POST</code> variable. So you can use <code>$_PO...
2019/02/22
[ "https://wordpress.stackexchange.com/questions/329629", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64243/" ]
I have this: PHP: ``` add_action('wp_ajax_count_messages', 'count_messages'); function count_messages($projectid) { //some code wp_send_json_success($projectid); } ``` JS: ``` var countData = { 'action': 'count_messages', 'projectid': '100' } var myRequest = $.ajax({ url: admin_ajax.aja...
The data you send from jQuey to PHP is in the `$_POST` variable. So you can use `$_POST['projectid']` inside your PHP function to get the data.
329,642
<p>I apologize if this is an easily answered question - I've been looking for a while and can't quite get my head around it.</p> <p>I would like to modify the first label for the wp-login.php page based on the potential user. My current plan is to use url parameters to differentiate users, have a function that checks ...
[ { "answer_id": 329630, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 1, "selected": true, "text": "<p>The data you send from jQuey to PHP is in the <code>$_POST</code> variable. So you can use <code>$_PO...
2019/02/22
[ "https://wordpress.stackexchange.com/questions/329642", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161855/" ]
I apologize if this is an easily answered question - I've been looking for a while and can't quite get my head around it. I would like to modify the first label for the wp-login.php page based on the potential user. My current plan is to use url parameters to differentiate users, have a function that checks for a para...
The data you send from jQuey to PHP is in the `$_POST` variable. So you can use `$_POST['projectid']` inside your PHP function to get the data.
329,648
<p>I want to have 3 Pages with 30 posts each: <strong>Total 90 posts.</strong> <strong>/page/4/ shouldn't exist</strong>. Should either 404 or redirect to home.</p> <p>Only /, /page/2/ and /page/3/ should exist. With 30 posts each, like so:</p> <ul> <li>/ <em>posts -> 01-30</em></li> <li>/page/2/ <em>posts -> 31-60</...
[ { "answer_id": 329652, "author": "hamdirizal", "author_id": 133145, "author_profile": "https://wordpress.stackexchange.com/users/133145", "pm_score": 0, "selected": false, "text": "<p>Your solution doesn't work because it is limiting the current loop to 90 records. <strong>It doesn't lim...
2019/02/22
[ "https://wordpress.stackexchange.com/questions/329648", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/77283/" ]
I want to have 3 Pages with 30 posts each: **Total 90 posts.** **/page/4/ shouldn't exist**. Should either 404 or redirect to home. Only /, /page/2/ and /page/3/ should exist. With 30 posts each, like so: * / *posts -> 01-30* * /page/2/ *posts -> 31-60* * /page/3/ *posts -> 61-90* I've tried numerous suggestions, no...
Try using `paginate_links( $args )`. Here is code adopted from [codex](https://codex.wordpress.org/Function_Reference/paginate_links#Example_With_a_Custom_Query). ``` $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $args = array( 'posts_per_page' => 30, 'paged' => $paged, ); $...
329,656
<p>How can I display a short url of the post in the content arrea like</p> <pre><code>Shortlink - https://www.example.com/abc24g4 </code></pre> <p>instead of the standard</p> <pre><code>Shortlink - http://example.com/?p=1234 </code></pre> <h2><strong>WITHOUT USING ANY PLUGINS or other services like bitly</strong></...
[ { "answer_id": 329652, "author": "hamdirizal", "author_id": 133145, "author_profile": "https://wordpress.stackexchange.com/users/133145", "pm_score": 0, "selected": false, "text": "<p>Your solution doesn't work because it is limiting the current loop to 90 records. <strong>It doesn't lim...
2019/02/23
[ "https://wordpress.stackexchange.com/questions/329656", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
How can I display a short url of the post in the content arrea like ``` Shortlink - https://www.example.com/abc24g4 ``` instead of the standard ``` Shortlink - http://example.com/?p=1234 ``` **WITHOUT USING ANY PLUGINS or other services like bitly** ----------------------------------------------------------
Try using `paginate_links( $args )`. Here is code adopted from [codex](https://codex.wordpress.org/Function_Reference/paginate_links#Example_With_a_Custom_Query). ``` $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $args = array( 'posts_per_page' => 30, 'paged' => $paged, ); $...
329,683
<p>We use automatic updates on our sites due to having many sites and so manual updates not being feasible in the low hosting costs.</p> <p>But due to Wordpress or mainly plugin updates having the possibility to break your site, and due to not knowing when Wordpress would actually do the updates which could also occur...
[ { "answer_id": 329689, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 1, "selected": false, "text": "<p>There's a question and an answer regarding WP (auto) updates here, <a href=\"https://wordpress.stack...
2019/02/23
[ "https://wordpress.stackexchange.com/questions/329683", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89983/" ]
We use automatic updates on our sites due to having many sites and so manual updates not being feasible in the low hosting costs. But due to Wordpress or mainly plugin updates having the possibility to break your site, and due to not knowing when Wordpress would actually do the updates which could also occur every day...
There's a question and an answer regarding WP (auto) updates here, [How To/What triggers a Wordpress auto update?](https://wordpress.stackexchange.com/questions/183202/how-to-what-triggers-a-wordpress-auto-update) The answer also has a link to a blog post on how to [force WordPress auto-update](http://blog.birdhouse.o...
329,696
<p>I was looking for a solution to get the image url starting from the uploaded media id.</p> <p>I'm using a custom field to specify which images to show on a post page. Then I retrieve the images ids with the REST api, and I need to create a gallery of images, based on the retrieved ids.</p> <p>Does anybody know how...
[ { "answer_id": 329698, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>You can use REST API to <a href=\"https://developer.wordpress.org/rest-api/reference/media/#retrieve-a...
2019/02/23
[ "https://wordpress.stackexchange.com/questions/329696", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48664/" ]
I was looking for a solution to get the image url starting from the uploaded media id. I'm using a custom field to specify which images to show on a post page. Then I retrieve the images ids with the REST api, and I need to create a gallery of images, based on the retrieved ids. Does anybody know how to retrieve the ...
You can use REST API to [retrieve media item](https://developer.wordpress.org/rest-api/reference/media/#retrieve-a-media-item). Just send GET request to this address (change example.com to your site): ``` http://example.com/wp-json/wp/v2/media/<id> ``` If you pass correct ID, then you'll get all info regarding that ...
329,702
<p>How can I be displayed in an article written by a writer in a text format only to the same author.</p>
[ { "answer_id": 329698, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>You can use REST API to <a href=\"https://developer.wordpress.org/rest-api/reference/media/#retrieve-a...
2019/02/23
[ "https://wordpress.stackexchange.com/questions/329702", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161894/" ]
How can I be displayed in an article written by a writer in a text format only to the same author.
You can use REST API to [retrieve media item](https://developer.wordpress.org/rest-api/reference/media/#retrieve-a-media-item). Just send GET request to this address (change example.com to your site): ``` http://example.com/wp-json/wp/v2/media/<id> ``` If you pass correct ID, then you'll get all info regarding that ...
329,715
<p>I created a page template to serve information dynamically.</p> <p>For url like</p> <p>example.com/the-hamptons => index.php?page_id=92&amp;filter=the-hamptons</p> <p>For url like</p> <p>example.com/page-that-exists &lt;- show page</p> <p>Basically, if the url points to a page that exists, show the page. If the...
[ { "answer_id": 329698, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>You can use REST API to <a href=\"https://developer.wordpress.org/rest-api/reference/media/#retrieve-a...
2019/02/24
[ "https://wordpress.stackexchange.com/questions/329715", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26514/" ]
I created a page template to serve information dynamically. For url like example.com/the-hamptons => index.php?page\_id=92&filter=the-hamptons For url like example.com/page-that-exists <- show page Basically, if the url points to a page that exists, show the page. If the page does not exist, pass everything after ...
You can use REST API to [retrieve media item](https://developer.wordpress.org/rest-api/reference/media/#retrieve-a-media-item). Just send GET request to this address (change example.com to your site): ``` http://example.com/wp-json/wp/v2/media/<id> ``` If you pass correct ID, then you'll get all info regarding that ...
329,739
<p>I want to create a background image effect that will change the image when the user scroll. I'm facing a problem with the images urls, how i can fix this? How I can link an image url in jquery from a wordpress page?</p> <p>Here is the code. The url is not correct and I can't figure how to link it correctly from the...
[ { "answer_id": 329698, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>You can use REST API to <a href=\"https://developer.wordpress.org/rest-api/reference/media/#retrieve-a...
2019/02/24
[ "https://wordpress.stackexchange.com/questions/329739", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/159508/" ]
I want to create a background image effect that will change the image when the user scroll. I'm facing a problem with the images urls, how i can fix this? How I can link an image url in jquery from a wordpress page? Here is the code. The url is not correct and I can't figure how to link it correctly from the js script...
You can use REST API to [retrieve media item](https://developer.wordpress.org/rest-api/reference/media/#retrieve-a-media-item). Just send GET request to this address (change example.com to your site): ``` http://example.com/wp-json/wp/v2/media/<id> ``` If you pass correct ID, then you'll get all info regarding that ...
329,746
<p>Here is the case, my <a href="https://iavinash.com" rel="nofollow noreferrer">oracle fusion</a> website was initially installed without SSL, last year using plugin “Really Simple SSL” plugin and following <a href="https://iavinash.com/free-ssl-make-website-https/" rel="nofollow noreferrer">this article</a> I changed...
[ { "answer_id": 329698, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>You can use REST API to <a href=\"https://developer.wordpress.org/rest-api/reference/media/#retrieve-a...
2019/02/24
[ "https://wordpress.stackexchange.com/questions/329746", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/101334/" ]
Here is the case, my [oracle fusion](https://iavinash.com) website was initially installed without SSL, last year using plugin “Really Simple SSL” plugin and following [this article](https://iavinash.com/free-ssl-make-website-https/) I changed it to HTTPS. Now my hosting provider is providing free SSL, the problem is,...
You can use REST API to [retrieve media item](https://developer.wordpress.org/rest-api/reference/media/#retrieve-a-media-item). Just send GET request to this address (change example.com to your site): ``` http://example.com/wp-json/wp/v2/media/<id> ``` If you pass correct ID, then you'll get all info regarding that ...
329,754
<p>I've created a block, and I need to save as post_meta a value from an action on the panel.</p> <p>Php side:</p> <pre><code>add_action( 'init', 'yasr_gutenberg_show_in_rest_overall_meta' ); function yasr_gutenberg_show_in_rest_overall_meta() { register_meta( 'post', 'yasr_overall_rating', array( ...
[ { "answer_id": 329698, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 3, "selected": true, "text": "<p>You can use REST API to <a href=\"https://developer.wordpress.org/rest-api/reference/media/#retrieve-a...
2019/02/24
[ "https://wordpress.stackexchange.com/questions/329754", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48442/" ]
I've created a block, and I need to save as post\_meta a value from an action on the panel. Php side: ``` add_action( 'init', 'yasr_gutenberg_show_in_rest_overall_meta' ); function yasr_gutenberg_show_in_rest_overall_meta() { register_meta( 'post', 'yasr_overall_rating', array( 'show_in_rest'...
You can use REST API to [retrieve media item](https://developer.wordpress.org/rest-api/reference/media/#retrieve-a-media-item). Just send GET request to this address (change example.com to your site): ``` http://example.com/wp-json/wp/v2/media/<id> ``` If you pass correct ID, then you'll get all info regarding that ...
329,869
<p><strong>TLDR; How can I run a shortcode with multiple shortcodes inside of it?</strong></p> <p>I'm trying to run a shortcode with multiple shortcodes inside of it.</p> <p>I can successfully run a shortcode with one shortcode inside of it with the following code in the theme:</p> <pre><code>add_shortcode('outside_...
[ { "answer_id": 329828, "author": "Tanmay Patel", "author_id": 62026, "author_profile": "https://wordpress.stackexchange.com/users/62026", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>If you know which particular shortcode you want to remove and you want\n to remove it p...
2019/02/25
[ "https://wordpress.stackexchange.com/questions/329869", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151661/" ]
**TLDR; How can I run a shortcode with multiple shortcodes inside of it?** I'm trying to run a shortcode with multiple shortcodes inside of it. I can successfully run a shortcode with one shortcode inside of it with the following code in the theme: ``` add_shortcode('outside_shortcode', function($attr, $content = nu...
I love to use this tool, [Search and Replace for WordPress Databases](https://interconnectit.com/products/search-and-replace-for-wordpress-databases/). It is basically a PHP script that is written for WordPress usage (but of course can be used with any database). When placed in the WordPress project, it automatically d...
329,875
<p>I have twentyseventeen child-theme, and I found this code:</p> <pre><code>add_action( 'wp_enqueue_scripts', 'child_enqueue_styles',99); function child_enqueue_styles() { $parent_style = 'parent-style'; wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'se...
[ { "answer_id": 329881, "author": "Qaisar Feroz", "author_id": 161501, "author_profile": "https://wordpress.stackexchange.com/users/161501", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>But there is problem that style.css is loading twice. </p>\n</blockquote>\n\n<p>This ...
2019/02/25
[ "https://wordpress.stackexchange.com/questions/329875", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/140882/" ]
I have twentyseventeen child-theme, and I found this code: ``` add_action( 'wp_enqueue_scripts', 'child_enqueue_styles',99); function child_enqueue_styles() { $parent_style = 'parent-style'; wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'seventeen-child'...
You usually don't need to enqueue a child theme's stylesheet. The parent theme does that. This is a bit confusing, so I'll explain. In most themes, Twenty Seventeen included, the stylesheet is loaded like this: ``` wp_enqueue_style( 'twentyseventeen-style', get_stylesheet_uri() ); ``` The trick to understanding wha...
329,886
<p>So I want to apply a theme and style the lost password page without the use of a plugin. I don't want it to show the default Wordpress lost password page. I managed to style the login form by redirecting the URL to the styled version, but I'm lost as to how I can style the lost password page. </p> <p>Any ideas?</p>...
[ { "answer_id": 329881, "author": "Qaisar Feroz", "author_id": 161501, "author_profile": "https://wordpress.stackexchange.com/users/161501", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>But there is problem that style.css is loading twice. </p>\n</blockquote>\n\n<p>This ...
2019/02/25
[ "https://wordpress.stackexchange.com/questions/329886", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/158774/" ]
So I want to apply a theme and style the lost password page without the use of a plugin. I don't want it to show the default Wordpress lost password page. I managed to style the login form by redirecting the URL to the styled version, but I'm lost as to how I can style the lost password page. Any ideas? Thanks!
You usually don't need to enqueue a child theme's stylesheet. The parent theme does that. This is a bit confusing, so I'll explain. In most themes, Twenty Seventeen included, the stylesheet is loaded like this: ``` wp_enqueue_style( 'twentyseventeen-style', get_stylesheet_uri() ); ``` The trick to understanding wha...
329,899
<p>I am writing a simple plugin to accept a user number, show a form with information about the user, then post a payment amount. The user number is obtained from this http file include_once(PLCOA_ADMIN_PATH . 'views/plcoa-payment-start.php'); and loads perfectly. The info form is filled out using the php file include_...
[ { "answer_id": 329902, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>I think you understand <a href=\"https://developer.wordpress.org/reference/functions/wp_redirect/\" r...
2019/02/25
[ "https://wordpress.stackexchange.com/questions/329899", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/141156/" ]
I am writing a simple plugin to accept a user number, show a form with information about the user, then post a payment amount. The user number is obtained from this http file include\_once(PLCOA\_ADMIN\_PATH . 'views/plcoa-payment-start.php'); and loads perfectly. The info form is filled out using the php file include\...
I think you understand [`wp_redirect`](https://developer.wordpress.org/reference/functions/wp_redirect/) incorrectly. This function redirects you to a different URL. It’s like sending `header('Location: ...');` On the other hand, it looks like you’re trying to pass local path as its param. So it won’t work - such pa...
329,904
<p>I'm trying to display a list of pages on an archive page. The query I've written is meant to only fetch pages but for some reason it is also displaying one post (from the archive page this is on) amongst the pages.</p> <p>Can anyone suggest what the issue is?</p> <p>Thanks in advance. </p> <pre><code> &...
[ { "answer_id": 329906, "author": "Qaisar Feroz", "author_id": 161501, "author_profile": "https://wordpress.stackexchange.com/users/161501", "pm_score": 0, "selected": false, "text": "<p>Apparently this part of code before while loop is introducing undesired result.</p>\n\n<pre><code> ...
2019/02/25
[ "https://wordpress.stackexchange.com/questions/329904", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/46039/" ]
I'm trying to display a list of pages on an archive page. The query I've written is meant to only fetch pages but for some reason it is also displaying one post (from the archive page this is on) amongst the pages. Can anyone suggest what the issue is? Thanks in advance. ``` <?php $page_args = array( 'p...
The issue turned out to be in another part of my code and nothing to do the the above query, which works just fine.
329,935
<p>I'm trying to link to a custom css file in a new folder of a small plugin I'm trying to make. I can't seem to get it to work. This is the line I have</p> <pre><code>echo '&lt;link rel="stylesheet" href="' . esc_url( plugins_url( 'public/css/front-end/uwc-tabs-style.css', __FILE__)) . '" &gt;'; </code></pre> <p>I'...
[ { "answer_id": 329937, "author": "John Cook", "author_id": 124439, "author_profile": "https://wordpress.stackexchange.com/users/124439", "pm_score": -1, "selected": false, "text": "<p>I worked it out. In case anyone else comes here looking for the answer here it is. I just had to add <co...
2019/02/26
[ "https://wordpress.stackexchange.com/questions/329935", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/124439/" ]
I'm trying to link to a custom css file in a new folder of a small plugin I'm trying to make. I can't seem to get it to work. This is the line I have ``` echo '<link rel="stylesheet" href="' . esc_url( plugins_url( 'public/css/front-end/uwc-tabs-style.css', __FILE__)) . '" >'; ``` I've also tried the following but ...
I would use `wp_enqueue_style()` for this instead of echoing a `<link>`.
329,938
<p>I'm trying to load jquery from CDN instead of loading natively with wordpress. In my functions.php I have done it like below, making sure it should only happen on the front-end:</p> <pre><code>function replace_jquery() { if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jque...
[ { "answer_id": 329940, "author": "brothman01", "author_id": 104630, "author_profile": "https://wordpress.stackexchange.com/users/104630", "pm_score": -1, "selected": false, "text": "<p>try <code>wp_dequeue_script( 'jquery-ui-core' );</code> instead of <code>wp_deregister_script()</code>....
2019/02/26
[ "https://wordpress.stackexchange.com/questions/329938", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/157281/" ]
I'm trying to load jquery from CDN instead of loading natively with wordpress. In my functions.php I have done it like below, making sure it should only happen on the front-end: ``` function replace_jquery() { if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery2', 'https:/...
The error message describes your problem quite clearly: > > Notice: wp\_deregister\_script was called **incorrectly**. > Do not deregister the `jquery` script in the administration area. > To target the front-end theme, use the `wp_enqueue_scripts` hook. > > > You're de-registering the script on the `init` ho...
329,952
<p>I have a multisite and a new theme that needs to be activated across all subsites. I found an answer by fuxia from 2012 and would like to know (1) if there have been changes in WordPress since that time that would require an update to this filter, and (2) what other methods exist to accomplish this task, like using ...
[ { "answer_id": 329958, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": true, "text": "<p>Fuxia was using <code>update_option</code> in her answer and it may work, but I wouldn't recommend tha...
2019/02/26
[ "https://wordpress.stackexchange.com/questions/329952", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162050/" ]
I have a multisite and a new theme that needs to be activated across all subsites. I found an answer by fuxia from 2012 and would like to know (1) if there have been changes in WordPress since that time that would require an update to this filter, and (2) what other methods exist to accomplish this task, like using the...
Fuxia was using `update_option` in her answer and it may work, but I wouldn't recommend that - it isn't the polite way of setting a theme. So how I would approach that problem? First of all, you want to perform this action only once and for all sites. So there is no point in using any hooks. Just run the code once a...
329,962
<p>I have tried to add custom <code>li</code> to my wordpress header menu using <code>functions.php</code>. Here is my code in <code>function</code> file.</p> <pre><code>function register_header_menu() { register_nav_menu('header-menu',__( 'Header Menu' )); } add_action( 'init', 'register_header_menu' ); </code></p...
[ { "answer_id": 329967, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>Default usage of <code>add_filter</code> looks like this:</p>\n\n<pre><code>add_filter( string $tag, ...
2019/02/26
[ "https://wordpress.stackexchange.com/questions/329962", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109465/" ]
I have tried to add custom `li` to my wordpress header menu using `functions.php`. Here is my code in `function` file. ``` function register_header_menu() { register_nav_menu('header-menu',__( 'Header Menu' )); } add_action( 'init', 'register_header_menu' ); ``` add new element to header menu ``` function add_ne...
Default usage of `add_filter` looks like this: ``` add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 ) ``` As you can see, the default priority is 10 and by default only one param is passed. In your code you need your filter to get 2 params, because [`wp_nav_menu_items`]...
329,976
<p>When I visit sitemap.xml of my WordPress website I see this error. Here is the image<a href="https://i.stack.imgur.com/J2X63.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J2X63.png" alt="enter image description here"></a></p>
[ { "answer_id": 329967, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>Default usage of <code>add_filter</code> looks like this:</p>\n\n<pre><code>add_filter( string $tag, ...
2019/02/26
[ "https://wordpress.stackexchange.com/questions/329976", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151277/" ]
When I visit sitemap.xml of my WordPress website I see this error. Here is the image[![enter image description here](https://i.stack.imgur.com/J2X63.png)](https://i.stack.imgur.com/J2X63.png)
Default usage of `add_filter` looks like this: ``` add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 ) ``` As you can see, the default priority is 10 and by default only one param is passed. In your code you need your filter to get 2 params, because [`wp_nav_menu_items`]...
330,008
<p>I have run into an issue with nonces becoming invalid, and being unable to refresh to a new nonce. In my example I have a Facebook Connect button, and a Facebook Disconnect button, each with their own nonce.</p> <p>Once either one of these button is pressed, an AJAX call is made, and the other button is sent throug...
[ { "answer_id": 329967, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>Default usage of <code>add_filter</code> looks like this:</p>\n\n<pre><code>add_filter( string $tag, ...
2019/02/26
[ "https://wordpress.stackexchange.com/questions/330008", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22588/" ]
I have run into an issue with nonces becoming invalid, and being unable to refresh to a new nonce. In my example I have a Facebook Connect button, and a Facebook Disconnect button, each with their own nonce. Once either one of these button is pressed, an AJAX call is made, and the other button is sent through AJAX and...
Default usage of `add_filter` looks like this: ``` add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 ) ``` As you can see, the default priority is 10 and by default only one param is passed. In your code you need your filter to get 2 params, because [`wp_nav_menu_items`]...
330,026
<p>I have created a page template called <code>concert.php</code> under <code>page-templates</code> directory with the following content: </p> <pre class="lang-php prettyprint-override"><code>&lt;?php /* Template Name: Concert*/ add_body_classes('page_concert'); /* Custom function that adds arguments to ...
[ { "answer_id": 329967, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>Default usage of <code>add_filter</code> looks like this:</p>\n\n<pre><code>add_filter( string $tag, ...
2019/02/26
[ "https://wordpress.stackexchange.com/questions/330026", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162086/" ]
I have created a page template called `concert.php` under `page-templates` directory with the following content: ```php <?php /* Template Name: Concert*/ add_body_classes('page_concert'); /* Custom function that adds arguments to body class using body_class filter */ ...
Default usage of `add_filter` looks like this: ``` add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 ) ``` As you can see, the default priority is 10 and by default only one param is passed. In your code you need your filter to get 2 params, because [`wp_nav_menu_items`]...
330,053
<p>I have been following a <a href="http://justintadlock.com/archives/2011/10/20/custom-user-taxonomies-in-wordpress" rel="nofollow noreferrer">tutorial</a> on setting up a user taxonomy on Justin Tadlock's site. I got everything working but I wanted to adjust the taxonomy from a single radio selection to a multi check...
[ { "answer_id": 330078, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>There are two errors in your code.</p>\n\n<p><strong>First one</strong> is the inconsistency in field...
2019/02/26
[ "https://wordpress.stackexchange.com/questions/330053", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161266/" ]
I have been following a [tutorial](http://justintadlock.com/archives/2011/10/20/custom-user-taxonomies-in-wordpress) on setting up a user taxonomy on Justin Tadlock's site. I got everything working but I wanted to adjust the taxonomy from a single radio selection to a multi checkbox selection. ``` // If there are any ...
There are two errors in your code. **First one** is the inconsistency in field names. Here’s your checkbox field: ``` <input type="checkbox" name="competence-<?php echo esc_attr( $term->slug ); ?>" id="competence-<?php echo esc_attr( $term->slug ); ?>" value="<?php echo esc_attr( $term->slug ); ?>" <?php checked( tr...
330,088
<p>If I click on a selection in the autocompleter of WordPress in codeMirror, the whole field is closed. To prevent this I want to add preventDefault to the click event.</p> <pre><code>var cm = wp.codeEditor.initialize( options.field, editorSettings ); var editor = cm.codemirror; jQuery('body').hover(function(e){ ...
[ { "answer_id": 330078, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>There are two errors in your code.</p>\n\n<p><strong>First one</strong> is the inconsistency in field...
2019/02/27
[ "https://wordpress.stackexchange.com/questions/330088", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/133541/" ]
If I click on a selection in the autocompleter of WordPress in codeMirror, the whole field is closed. To prevent this I want to add preventDefault to the click event. ``` var cm = wp.codeEditor.initialize( options.field, editorSettings ); var editor = cm.codemirror; jQuery('body').hover(function(e){ if(jQue...
There are two errors in your code. **First one** is the inconsistency in field names. Here’s your checkbox field: ``` <input type="checkbox" name="competence-<?php echo esc_attr( $term->slug ); ?>" id="competence-<?php echo esc_attr( $term->slug ); ?>" value="<?php echo esc_attr( $term->slug ); ?>" <?php checked( tr...
330,091
<p>I have this code for show count of posts by category.</p> <p>If I visit category sports, show in header 34 articles. If I visit Nutrition Category show in header 12 articles.</p> <p>But this code is wrong, anyone know why?</p> <pre><code>add_shortcode('catcount', 'wp_get_cat_postcount'); function wp_get_cat_postc...
[ { "answer_id": 330078, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 1, "selected": false, "text": "<p>There are two errors in your code.</p>\n\n<p><strong>First one</strong> is the inconsistency in field...
2019/02/27
[ "https://wordpress.stackexchange.com/questions/330091", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/142081/" ]
I have this code for show count of posts by category. If I visit category sports, show in header 34 articles. If I visit Nutrition Category show in header 12 articles. But this code is wrong, anyone know why? ``` add_shortcode('catcount', 'wp_get_cat_postcount'); function wp_get_cat_postcount($id) { $cat= get_th...
There are two errors in your code. **First one** is the inconsistency in field names. Here’s your checkbox field: ``` <input type="checkbox" name="competence-<?php echo esc_attr( $term->slug ); ?>" id="competence-<?php echo esc_attr( $term->slug ); ?>" value="<?php echo esc_attr( $term->slug ); ?>" <?php checked( tr...
330,104
<p>I am learning Wordpress Development.</p> <p>I am noticing whenever I encountered a problem I usually check the web for similar issue(s) for the solution.</p> <p>Anyway, what I want to ask is, I've noticed, most of the time a solution of using ID is being used. I am thinking that isn't a general solution if that th...
[ { "answer_id": 330108, "author": "Qaisar Feroz", "author_id": 161501, "author_profile": "https://wordpress.stackexchange.com/users/161501", "pm_score": -1, "selected": false, "text": "<blockquote>\n <p>Anyway, what I want to ask is, I've noticed, most of the time a solution of using ID ...
2019/02/27
[ "https://wordpress.stackexchange.com/questions/330104", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161005/" ]
I am learning Wordpress Development. I am noticing whenever I encountered a problem I usually check the web for similar issue(s) for the solution. Anyway, what I want to ask is, I've noticed, most of the time a solution of using ID is being used. I am thinking that isn't a general solution if that theme will be used ...
You're absolutely correct that hard-coding specific IDs is a bad idea. IDs are very much subject to change, and normal activity through the UI can cause problems with any code expecting a specific ID, which makes them fragile. However, when you see solutions involving a specific ID, you need to keep in mind that the s...
330,118
<p>I am using this function which is supposed to prevent wordpress from automatically logging me out. However, I am still being logged out every so often.</p> <pre><code>function my_logged_in( $expirein ) { return 31556926; // 1 year in seconds } add_filter( 'auth_cookie_expiration', 'my_logged_in' ); </code></pre>...
[ { "answer_id": 330119, "author": "Xavier C.", "author_id": 81047, "author_profile": "https://wordpress.stackexchange.com/users/81047", "pm_score": 0, "selected": false, "text": "<p>Did you take a look at your session.gc_maxlifetime in your php settings?\nAlso, some operating systems like...
2019/02/27
[ "https://wordpress.stackexchange.com/questions/330118", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/40727/" ]
I am using this function which is supposed to prevent wordpress from automatically logging me out. However, I am still being logged out every so often. ``` function my_logged_in( $expirein ) { return 31556926; // 1 year in seconds } add_filter( 'auth_cookie_expiration', 'my_logged_in' ); ``` Is there another solu...
As we know by default WordPress keeps logged in for `48 Hours`. If we check "Remember me" while login then it will keep login for 14 Days. If you want to set the logout timeout you can use this code as: ``` function wpset_change_cookie_logout( $expiration, $user_id, $remember ) { if( $remember && user_can( $user_...
330,135
<p>I'm having issues to change the subject of the email sent out when password is changed. I have managed to change the message by doing this:</p> <pre><code>// Change Email to HTML function function set_email_html_content_type() { return 'text/html'; } // Replace the default password change email add_filter('pas...
[ { "answer_id": 330140, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 2, "selected": true, "text": "<p>The <code>$change_mail</code> variable that you're filtering has a <code>subject</code> value that you c...
2019/02/27
[ "https://wordpress.stackexchange.com/questions/330135", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143279/" ]
I'm having issues to change the subject of the email sent out when password is changed. I have managed to change the message by doing this: ``` // Change Email to HTML function function set_email_html_content_type() { return 'text/html'; } // Replace the default password change email add_filter('password_change_e...
The `$change_mail` variable that you're filtering has a `subject` value that you can modify the same way you modified the message: ``` // Replace the default password change email add_filter('password_change_email', 'change_password_mail_message', 10, 3); function change_password_mail_message( $change_mail, $user, $us...
330,156
<p>I want to display only 3 categories (Ex: horses, dogs, birds), names only and comma separated, in my Post, since one of them, two or all tree are marked in the post.</p> <pre><code> &lt;span&gt;&lt;?php if ( 'in_category('horses') ) { echo "horses"; } ?&gt;&lt;/span&gt;&lt;span&gt;&lt;?php if ( in_category('...
[ { "answer_id": 330165, "author": "Fabrizio Mele", "author_id": 40463, "author_profile": "https://wordpress.stackexchange.com/users/40463", "pm_score": 3, "selected": true, "text": "<p>It should be enough using a single <code>&lt;span&gt;</code> for all categories and add some logic.:</p>...
2019/02/27
[ "https://wordpress.stackexchange.com/questions/330156", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162089/" ]
I want to display only 3 categories (Ex: horses, dogs, birds), names only and comma separated, in my Post, since one of them, two or all tree are marked in the post. ``` <span><?php if ( 'in_category('horses') ) { echo "horses"; } ?></span><span><?php if ( in_category('dogs') ) { echo "dogs"; } ?></span><s...
It should be enough using a single `<span>` for all categories and add some logic.: ```php <span><?php $categories = ['horses','dogs','birds']; $string = ""; foreach ($categories as $category){ //iterate over the categories to check if(has_category($category)) $string .= $category.", "; //if in_category a...
330,173
<p>I have a user that is receiving notification emails to their personal email address and we would like to have it be changed to more of public one that is used by the company. I have tried to change the Email Address field in the UI under Settings->General and when I do, the notifications are still being sent to the ...
[ { "answer_id": 330165, "author": "Fabrizio Mele", "author_id": 40463, "author_profile": "https://wordpress.stackexchange.com/users/40463", "pm_score": 3, "selected": true, "text": "<p>It should be enough using a single <code>&lt;span&gt;</code> for all categories and add some logic.:</p>...
2019/02/27
[ "https://wordpress.stackexchange.com/questions/330173", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162182/" ]
I have a user that is receiving notification emails to their personal email address and we would like to have it be changed to more of public one that is used by the company. I have tried to change the Email Address field in the UI under Settings->General and when I do, the notifications are still being sent to the sam...
It should be enough using a single `<span>` for all categories and add some logic.: ```php <span><?php $categories = ['horses','dogs','birds']; $string = ""; foreach ($categories as $category){ //iterate over the categories to check if(has_category($category)) $string .= $category.", "; //if in_category a...
330,174
<p>For some reason, some of the thumbnails of my media library are randomly becoming missing.</p> <p>I've found out <code>_wp_attachment_metadata</code> isn't present in the database for those images with missing thumbnails. The files, however, are present on disk - both the original file and the "cropped" sizes.</p> ...
[ { "answer_id": 330175, "author": "That Brazilian Guy", "author_id": 22510, "author_profile": "https://wordpress.stackexchange.com/users/22510", "pm_score": 4, "selected": true, "text": "<p>Running the <a href=\"https://developer.wordpress.org/cli/commands/media/regenerate/\" rel=\"norefe...
2019/02/27
[ "https://wordpress.stackexchange.com/questions/330174", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22510/" ]
For some reason, some of the thumbnails of my media library are randomly becoming missing. I've found out `_wp_attachment_metadata` isn't present in the database for those images with missing thumbnails. The files, however, are present on disk - both the original file and the "cropped" sizes. --- ***The purpose of t...
Running the [`wp media regenerate` command](https://developer.wordpress.org/cli/commands/media/regenerate/) from WP-CLI with the `--only-missing` argument is quite fast (takes about 30 seconds for 4000 images) and rebuilds `_wp_attachment_metadata` correctly: `wp media regenerate --only-missing`
330,248
<p>I am not using WPML or Polylang, but multisite to create multiple languages. The code below is used to make a language switcher, but I want a second menu with the full language name for a different menu (i.e. EN should be English, FR - Français, DE - Deutsch). Wordpress has the native names stored (because when sele...
[ { "answer_id": 330231, "author": "Rob", "author_id": 94286, "author_profile": "https://wordpress.stackexchange.com/users/94286", "pm_score": 0, "selected": false, "text": "<p>That's perfectly normal, it's a security feature.</p>\n\n<p>My advice is that you do it via FTP and add the code ...
2019/02/28
[ "https://wordpress.stackexchange.com/questions/330248", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/87656/" ]
I am not using WPML or Polylang, but multisite to create multiple languages. The code below is used to make a language switcher, but I want a second menu with the full language name for a different menu (i.e. EN should be English, FR - Français, DE - Deutsch). Wordpress has the native names stored (because when selecti...
You can use this Plugin and it will automatically insert the code for you on every page. Just download the plugin and add your code to the header box that the pugin provides. Super easy to use and super lightweight. Plugin: Insert Headers and Footers <https://pt.wordpress.org/plugins/insert-headers-and-footers/>
330,251
<p>I´d like to automatically load three images inside all posts (via single.php), always in the same div (.acf_imgs-centro1). The idea is that the images are uploaded into uploads folder, with the same name as the post, and then they will be displayed inside the post. I can do it using the code bellow, but there is a p...
[ { "answer_id": 330231, "author": "Rob", "author_id": 94286, "author_profile": "https://wordpress.stackexchange.com/users/94286", "pm_score": 0, "selected": false, "text": "<p>That's perfectly normal, it's a security feature.</p>\n\n<p>My advice is that you do it via FTP and add the code ...
2019/02/28
[ "https://wordpress.stackexchange.com/questions/330251", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162089/" ]
I´d like to automatically load three images inside all posts (via single.php), always in the same div (.acf\_imgs-centro1). The idea is that the images are uploaded into uploads folder, with the same name as the post, and then they will be displayed inside the post. I can do it using the code bellow, but there is a pro...
You can use this Plugin and it will automatically insert the code for you on every page. Just download the plugin and add your code to the header box that the pugin provides. Super easy to use and super lightweight. Plugin: Insert Headers and Footers <https://pt.wordpress.org/plugins/insert-headers-and-footers/>
330,255
<p>I'm making a website with the Primer theme, and it includes a big bar with the title in huge letters across every page. I prefer the titles be in the body of the post, so I want to delete the title bar altogether.</p> <p>However, inserts that have been suggested on here like </p> <pre><code>.page_header { display:...
[ { "answer_id": 330231, "author": "Rob", "author_id": 94286, "author_profile": "https://wordpress.stackexchange.com/users/94286", "pm_score": 0, "selected": false, "text": "<p>That's perfectly normal, it's a security feature.</p>\n\n<p>My advice is that you do it via FTP and add the code ...
2019/02/28
[ "https://wordpress.stackexchange.com/questions/330255", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162208/" ]
I'm making a website with the Primer theme, and it includes a big bar with the title in huge letters across every page. I prefer the titles be in the body of the post, so I want to delete the title bar altogether. However, inserts that have been suggested on here like ``` .page_header { display: none !important; } ...
You can use this Plugin and it will automatically insert the code for you on every page. Just download the plugin and add your code to the header box that the pugin provides. Super easy to use and super lightweight. Plugin: Insert Headers and Footers <https://pt.wordpress.org/plugins/insert-headers-and-footers/>
330,346
<p>I have a function which adds a <code>posts_join</code> and a <code>posts_where</code> to searches in <code>WP_Query</code>. It works fine on a normal, php rendered search page. However i'm also using it for a ajax product search and the additional <code>posts_join</code> and a <code>posts_where</code> don't seem to ...
[ { "answer_id": 330348, "author": "HU is Sebastian", "author_id": 56587, "author_profile": "https://wordpress.stackexchange.com/users/56587", "pm_score": -1, "selected": false, "text": "<p>If you use ajax, is_search() return false. You have to define a global variable or a constant for us...
2019/03/01
[ "https://wordpress.stackexchange.com/questions/330346", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/146026/" ]
I have a function which adds a `posts_join` and a `posts_where` to searches in `WP_Query`. It works fine on a normal, php rendered search page. However i'm also using it for a ajax product search and the additional `posts_join` and a `posts_where` don't seem to apply. Here's the join and where: ``` function search_by...
`is_search()` is only true if the *main* query is for the search results. When you create your own query with `new WP_Query`, you're not using the main query. Additionally, AJAX requests do not even have a main query, so functions like `is_search()`, `is_archive()` etc. do not work. If you want to check if a specific ...
330,356
<p>I'm trying to understand how datas are being handled when saving to the database in the <strong><em>wpdb</em></strong> class. I have searched for where HTML string datas are handled and found a method in the <code>$this-&gt;query()</code> method in the wpdb class where the query string is being stripped and thought ...
[ { "answer_id": 330348, "author": "HU is Sebastian", "author_id": 56587, "author_profile": "https://wordpress.stackexchange.com/users/56587", "pm_score": -1, "selected": false, "text": "<p>If you use ajax, is_search() return false. You have to define a global variable or a constant for us...
2019/03/01
[ "https://wordpress.stackexchange.com/questions/330356", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3216/" ]
I'm trying to understand how datas are being handled when saving to the database in the ***wpdb*** class. I have searched for where HTML string datas are handled and found a method in the `$this->query()` method in the wpdb class where the query string is being stripped and thought it could be there. It's on [line 1798...
`is_search()` is only true if the *main* query is for the search results. When you create your own query with `new WP_Query`, you're not using the main query. Additionally, AJAX requests do not even have a main query, so functions like `is_search()`, `is_archive()` etc. do not work. If you want to check if a specific ...
330,362
<p>I have a custom table in the WP database called wp_products. It has columns titled ID, SKU, Details and Page. I'm trying to search this table via the default search box, so I've replaced my search.php file with the code below. This isn't working and I don't know enough PHP to fix it. Can anyone help me out with this...
[ { "answer_id": 330348, "author": "HU is Sebastian", "author_id": 56587, "author_profile": "https://wordpress.stackexchange.com/users/56587", "pm_score": -1, "selected": false, "text": "<p>If you use ajax, is_search() return false. You have to define a global variable or a constant for us...
2019/03/01
[ "https://wordpress.stackexchange.com/questions/330362", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162295/" ]
I have a custom table in the WP database called wp\_products. It has columns titled ID, SKU, Details and Page. I'm trying to search this table via the default search box, so I've replaced my search.php file with the code below. This isn't working and I don't know enough PHP to fix it. Can anyone help me out with this? ...
`is_search()` is only true if the *main* query is for the search results. When you create your own query with `new WP_Query`, you're not using the main query. Additionally, AJAX requests do not even have a main query, so functions like `is_search()`, `is_archive()` etc. do not work. If you want to check if a specific ...
330,367
<p>I am new in wordpress , started plugin development in wordpress a week ago . I have to add the new custom field in default <em>add user form</em> , is it possible . Then i if write wp_get_current_user() , is it possible to get the data which is added in the new custom field ? Any body please help . Thank you in ad...
[ { "answer_id": 330378, "author": "Roman Bitca", "author_id": 150500, "author_profile": "https://wordpress.stackexchange.com/users/150500", "pm_score": 3, "selected": true, "text": "<p>It is possible. For that we will use 4 hooks (actions): show_user_profile, edit_user_profile, personal_o...
2019/03/01
[ "https://wordpress.stackexchange.com/questions/330367", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161732/" ]
I am new in wordpress , started plugin development in wordpress a week ago . I have to add the new custom field in default *add user form* , is it possible . Then i if write wp\_get\_current\_user() , is it possible to get the data which is added in the new custom field ? Any body please help . Thank you in advance .
It is possible. For that we will use 4 hooks (actions): show\_user\_profile, edit\_user\_profile, personal\_options\_update, edit\_user\_profile\_update. Here is the example how to add extra field to user in WordPress. Adding user info fields function ``` add_action( 'show_user_profile', 'extra_user_profile_fields',...
330,369
<p>I use this function to add prices to my WooCommerce variation dropdown menu. I am trying to wrap the price with a span tag but it's displaying the tags as text.</p> <pre><code>add_filter( 'woocommerce_variation_option_name','display_price_in_variation_option_name'); function display_price_in_variation_option_name( ...
[ { "answer_id": 330378, "author": "Roman Bitca", "author_id": 150500, "author_profile": "https://wordpress.stackexchange.com/users/150500", "pm_score": 3, "selected": true, "text": "<p>It is possible. For that we will use 4 hooks (actions): show_user_profile, edit_user_profile, personal_o...
2019/03/01
[ "https://wordpress.stackexchange.com/questions/330369", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134343/" ]
I use this function to add prices to my WooCommerce variation dropdown menu. I am trying to wrap the price with a span tag but it's displaying the tags as text. ``` add_filter( 'woocommerce_variation_option_name','display_price_in_variation_option_name'); function display_price_in_variation_option_name( $term ) { ...
It is possible. For that we will use 4 hooks (actions): show\_user\_profile, edit\_user\_profile, personal\_options\_update, edit\_user\_profile\_update. Here is the example how to add extra field to user in WordPress. Adding user info fields function ``` add_action( 'show_user_profile', 'extra_user_profile_fields',...
330,375
<p>I have a problem - when I click on "Wordpress update", I receive this message:</p> <blockquote> <p>Downloading update from <a href="https://downloads.wordpress.org/release/wordpress-5.1-new-bundled.zip" rel="nofollow noreferrer">https://downloads.wordpress.org/release/wordpress-5.1-new-bundled.zip</a>… Unpacking ...
[ { "answer_id": 330378, "author": "Roman Bitca", "author_id": 150500, "author_profile": "https://wordpress.stackexchange.com/users/150500", "pm_score": 3, "selected": true, "text": "<p>It is possible. For that we will use 4 hooks (actions): show_user_profile, edit_user_profile, personal_o...
2019/03/01
[ "https://wordpress.stackexchange.com/questions/330375", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/134556/" ]
I have a problem - when I click on "Wordpress update", I receive this message: > > Downloading update from <https://downloads.wordpress.org/release/wordpress-5.1-new-bundled.zip>… Unpacking the update… The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent fil...
It is possible. For that we will use 4 hooks (actions): show\_user\_profile, edit\_user\_profile, personal\_options\_update, edit\_user\_profile\_update. Here is the example how to add extra field to user in WordPress. Adding user info fields function ``` add_action( 'show_user_profile', 'extra_user_profile_fields',...
330,377
<p>I wrote a plugin to hit an API and display results on a page. When I was testing, every time I hit "preview", the plugin would hit the API and retrieve the most recent data. Now that the plugin is live, when I navigate to the live page, no calls are being made to the API.</p> <p>Through research I believe this is a...
[ { "answer_id": 330378, "author": "Roman Bitca", "author_id": 150500, "author_profile": "https://wordpress.stackexchange.com/users/150500", "pm_score": 3, "selected": true, "text": "<p>It is possible. For that we will use 4 hooks (actions): show_user_profile, edit_user_profile, personal_o...
2019/03/01
[ "https://wordpress.stackexchange.com/questions/330377", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162301/" ]
I wrote a plugin to hit an API and display results on a page. When I was testing, every time I hit "preview", the plugin would hit the API and retrieve the most recent data. Now that the plugin is live, when I navigate to the live page, no calls are being made to the API. Through research I believe this is a caching i...
It is possible. For that we will use 4 hooks (actions): show\_user\_profile, edit\_user\_profile, personal\_options\_update, edit\_user\_profile\_update. Here is the example how to add extra field to user in WordPress. Adding user info fields function ``` add_action( 'show_user_profile', 'extra_user_profile_fields',...
330,387
<p>Anybody know how to make the "add to cart" visible on product page? I did an update of content-product.php and after that the add to cart and choose style options are gone. Please check the link below:</p> <p><a href="https://twinklebelle.com/product-category/rain-gear/rain-pants/" rel="nofollow noreferrer">https:/...
[ { "answer_id": 330378, "author": "Roman Bitca", "author_id": 150500, "author_profile": "https://wordpress.stackexchange.com/users/150500", "pm_score": 3, "selected": true, "text": "<p>It is possible. For that we will use 4 hooks (actions): show_user_profile, edit_user_profile, personal_o...
2019/03/01
[ "https://wordpress.stackexchange.com/questions/330387", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162304/" ]
Anybody know how to make the "add to cart" visible on product page? I did an update of content-product.php and after that the add to cart and choose style options are gone. Please check the link below: <https://twinklebelle.com/product-category/rain-gear/rain-pants/>
It is possible. For that we will use 4 hooks (actions): show\_user\_profile, edit\_user\_profile, personal\_options\_update, edit\_user\_profile\_update. Here is the example how to add extra field to user in WordPress. Adding user info fields function ``` add_action( 'show_user_profile', 'extra_user_profile_fields',...
330,444
<p>I have been using WP All Import (to varying degrees of success) to import products to my Woo Commerce site. My server keeps timing out and stopping the import which is causing me difficulty and I have followed the official advise from the plugin without much luck. My imports are broken into ~12 CSV files, the large...
[ { "answer_id": 330378, "author": "Roman Bitca", "author_id": 150500, "author_profile": "https://wordpress.stackexchange.com/users/150500", "pm_score": 3, "selected": true, "text": "<p>It is possible. For that we will use 4 hooks (actions): show_user_profile, edit_user_profile, personal_o...
2019/03/02
[ "https://wordpress.stackexchange.com/questions/330444", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/148232/" ]
I have been using WP All Import (to varying degrees of success) to import products to my Woo Commerce site. My server keeps timing out and stopping the import which is causing me difficulty and I have followed the official advise from the plugin without much luck. My imports are broken into ~12 CSV files, the largest w...
It is possible. For that we will use 4 hooks (actions): show\_user\_profile, edit\_user\_profile, personal\_options\_update, edit\_user\_profile\_update. Here is the example how to add extra field to user in WordPress. Adding user info fields function ``` add_action( 'show_user_profile', 'extra_user_profile_fields',...
330,460
<p>I've twice had my site's url changed in the database. This is the only piece of data being altered. Whoever is doing this is then redirecting the site to a script at this location:</p> <pre><code>somelandingpage [dot] com/3gGykjDJ?frm=script </code></pre> <p>I've tried preventing XSS and have checked/updated every...
[ { "answer_id": 330469, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 1, "selected": false, "text": "<p>YOu need to deeply look throughout your site for the 'infection'/malware code. This would include the ...
2019/03/02
[ "https://wordpress.stackexchange.com/questions/330460", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162371/" ]
I've twice had my site's url changed in the database. This is the only piece of data being altered. Whoever is doing this is then redirecting the site to a script at this location: ``` somelandingpage [dot] com/3gGykjDJ?frm=script ``` I've tried preventing XSS and have checked/updated every single plugin and I canno...
YOu need to deeply look throughout your site for the 'infection'/malware code. This would include the following steps: * update everything (WP, themes, plugins) * change credentials on everything (hosting, FTP, admin-level users) * create a new admin user, log in as it, then delete the user called 'admin' (or demote t...
330,465
<p>Wordpress has a <a href="https://en.support.wordpress.com/site-icons/" rel="nofollow noreferrer">"Site Icon"</a> feature that serves correctly-sized favicons and so on to browsers. Is there a way to drive this feature programmatically, eg. by uploading media and setting an option with <code>wp cli</code>?</p>
[ { "answer_id": 330657, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>The 'official rules' about site icons are here:<a href=\"https://www.w3.org/TR/html5/links.html#link-t...
2019/03/02
[ "https://wordpress.stackexchange.com/questions/330465", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162374/" ]
Wordpress has a ["Site Icon"](https://en.support.wordpress.com/site-icons/) feature that serves correctly-sized favicons and so on to browsers. Is there a way to drive this feature programmatically, eg. by uploading media and setting an option with `wp cli`?
Use wp-cli commands `wp media import` and `wp option update`. `wp media import <file>` : Creates attachments from local files or URLs. `wp option update <key>` : Updates an option value. **Image from theme folder** : ``` $ wp media import "$(wp theme path)/theme/assets/images/logo.png" --porcelain | wp option updat...
330,471
<p>I'm using a filter in the Block API to add a class name to a block's wrapper. I have to add the class name to a specific block, not all blocks.</p> <p>I tried:</p> <pre><code>const addClassName = createHigherOrderComponent( ( BlockListBlock ) =&gt; { return ( props, blockType ) =&gt; { if ( blockTy...
[ { "answer_id": 330667, "author": "Alvaro", "author_id": 16533, "author_profile": "https://wordpress.stackexchange.com/users/16533", "pm_score": 3, "selected": true, "text": "<p>From the props object we can get the block information. The object contains the <code>name</code> property you ...
2019/03/02
[ "https://wordpress.stackexchange.com/questions/330471", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111085/" ]
I'm using a filter in the Block API to add a class name to a block's wrapper. I have to add the class name to a specific block, not all blocks. I tried: ``` const addClassName = createHigherOrderComponent( ( BlockListBlock ) => { return ( props, blockType ) => { if ( blockType.name === 'myplugin/myblo...
From the props object we can get the block information. The object contains the `name` property you are looking for; this would be the code: ``` const addClassName = createHigherOrderComponent(BlockListBlock => { return props => { if (props.name === "myplugin/myblock") { return <BlockListBlock ...
330,527
<p>Is anyone aware of means to add html directly under the body tag on the wordpress login page, ideally using functions.php? </p> <p>I'm aware of the various hooks and filters listed in the codex, but I have a use case which requires a simple line of html be present across the whole site and after several hours of re...
[ { "answer_id": 330528, "author": "Chinmoy Kumar Paul", "author_id": 57436, "author_profile": "https://wordpress.stackexchange.com/users/57436", "pm_score": 2, "selected": false, "text": "<p>If you look the <strong>wp-login.php</strong> file, you will see a hook <strong>login_header</stro...
2019/03/03
[ "https://wordpress.stackexchange.com/questions/330527", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3782/" ]
Is anyone aware of means to add html directly under the body tag on the wordpress login page, ideally using functions.php? I'm aware of the various hooks and filters listed in the codex, but I have a use case which requires a simple line of html be present across the whole site and after several hours of research I'm...
If you look the **wp-login.php** file, you will see a hook **login\_header**. So you add any custom content above the login form. Here is the example: ``` add_action( 'login_header', 'wpse330527_add_html_content' ); function wpse330527_add_html_content() { ?> ENTER YOUR HTML CODE <?php } ``` You will add the code ...