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
217,340
<p>So within my Customizer I have a section that controls this Slider on the Homepage - the thing the client might not want to use all the Slider Images but all the Sliders still show anyway and the ones without an Image just show the alt tag.</p> <p>Is there a way to basically check if there is a image and if not don...
[ { "answer_id": 217350, "author": "majick", "author_id": 76440, "author_profile": "https://wordpress.stackexchange.com/users/76440", "pm_score": 2, "selected": false, "text": "<p>Just do a conditional check slightly earlier to wrap the div?</p>\n\n<pre><code>&lt;?php if ( get_theme_mod( '...
2016/02/11
[ "https://wordpress.stackexchange.com/questions/217340", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/85776/" ]
So within my Customizer I have a section that controls this Slider on the Homepage - the thing the client might not want to use all the Slider Images but all the Sliders still show anyway and the ones without an Image just show the alt tag. Is there a way to basically check if there is a image and if not don't display...
Try the following code: ``` <div class="item active <?php // If image URL is empty, echo "hidden" echo (get_theme_mod('slider_one', '') == '' ? 'hidden' : ''); ?>"> <img class="img-responsive" src="<?php echo esc_url( get_theme_mod( 'slider_one', '' ) ); ?>" alt="Slider 1"> </div> ``` Then use the follow...
217,364
<p>I have two sites which I've copied a plugin from the first site and then altered the plugin and changed the name of plugins directoy and class name.</p> <p>Like from:</p> <pre><code>old_xplugin </code></pre> <p>In the root of this plugin I have file called <code>old_xplugin.php</code> and class name equiavivalent...
[ { "answer_id": 217365, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 1, "selected": false, "text": "<p>No idea why the change of folder name makes a difference, but you should add jquery as dependency in your...
2016/02/11
[ "https://wordpress.stackexchange.com/questions/217364", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38848/" ]
I have two sites which I've copied a plugin from the first site and then altered the plugin and changed the name of plugins directoy and class name. Like from: ``` old_xplugin ``` In the root of this plugin I have file called `old_xplugin.php` and class name equiavivalent: `class old_xplugin` TO `new_xplugin` (no...
No idea why the change of folder name makes a difference, but you should add jquery as dependency in your enqueue ``` wp_enqueue_script( 'wtfjs', plugins_url( '/js/wtf.js' , __FILE__), array('jquery') ); ```
217,390
<p>I am trying to enqueue multiple Google fonts with multiple weights (400,600,700, etc,) and styles (normal, italic) and can't figure out why it is not working. </p> <p>This is the code that I am using in the functions.php:</p> <pre><code>function load_fonts() { wp_register_style('googleFonts', 'http://fonts.googlea...
[ { "answer_id": 217395, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 2, "selected": false, "text": "<p>The default themes, TwentyXXXX, do it somewhat like this:</p>\n\n<pre><code>add_action( 'wp_enqueue...
2016/02/11
[ "https://wordpress.stackexchange.com/questions/217390", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/87090/" ]
I am trying to enqueue multiple Google fonts with multiple weights (400,600,700, etc,) and styles (normal, italic) and can't figure out why it is not working. This is the code that I am using in the functions.php: ``` function load_fonts() { wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Do...
The default themes, TwentyXXXX, do it somewhat like this: ``` add_action( 'wp_enqueue_scripts', 'wpse217390_enqueue_google_fonts' ); function wpse217390_enqueue_google_fonts() { $query_args = array( 'family' => 'Dosis:400,600,700|Roboto:400,400italic,700,700italic' ); wp_register_style( 'google-fonts', ...
217,413
<p>It's showing <code>widgets.php</code>:</p> <p><a href="https://i.stack.imgur.com/pSn9D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pSn9D.png" alt="enter image description here"></a></p> <p>Not showing customizer:</p> <p><a href="https://i.stack.imgur.com/VUrfE.png" rel="nofollow noreferrer"...
[ { "answer_id": 217414, "author": "Sören Wrede", "author_id": 68682, "author_profile": "https://wordpress.stackexchange.com/users/68682", "pm_score": 2, "selected": false, "text": "<p>You have to put the function <code>footer_sidebar()</code> in the file functions.php not sidebar.php</p>\...
2016/02/11
[ "https://wordpress.stackexchange.com/questions/217413", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88537/" ]
It's showing `widgets.php`: [![enter image description here](https://i.stack.imgur.com/pSn9D.png)](https://i.stack.imgur.com/pSn9D.png) Not showing customizer: [![not show customizer](https://i.stack.imgur.com/VUrfE.png)](https://i.stack.imgur.com/VUrfE.png) **sidebar.php** ``` function footer_sidebar() { regi...
You have to put the function `footer_sidebar()` in the file functions.php not sidebar.php Is the footer.php included on site you opened the customizer?
217,420
<p>I have a Wordpress based site with an additional custom PHP application with files in it's own folders - "staff", "volunteers" etc. We have mod-rewrite in .htaccess file so we can use permalinks</p> <pre><code># BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteRule ^index\.php$ -...
[ { "answer_id": 217421, "author": "Linnea Huxford", "author_id": 86210, "author_profile": "https://wordpress.stackexchange.com/users/86210", "pm_score": 0, "selected": false, "text": "<p>WordPress has several methods for seeing PHP Errors, Warnings, and Notices. Specifically, you can set ...
2016/02/12
[ "https://wordpress.stackexchange.com/questions/217420", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44405/" ]
I have a Wordpress based site with an additional custom PHP application with files in it's own folders - "staff", "volunteers" etc. We have mod-rewrite in .htaccess file so we can use permalinks ``` # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{R...
You can add a [`RewriteRule`](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) to your `.htaccess` to instruct `mod_rewrite` to stop processing any URI that begins with `Staff/` or resolves to `Staff`: ``` # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L...
217,441
<p>My plugin uses the following code to reference a file, but I've read <code>WP_PLUGIN_DIR</code> won't work if a user renames the default plugin folder. I would also like to replace <code>/location-specific-menu-items/</code>with a reference to the current plugin folder. </p> <pre><code>$gi = geoip_open(WP_PLUGIN_DI...
[ { "answer_id": 217451, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 4, "selected": true, "text": "<p>If the plugin structure is:</p>\n\n<pre><code>plugins/\n some-plugin/\n some-plugin.php\n data/\...
2016/02/12
[ "https://wordpress.stackexchange.com/questions/217441", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81557/" ]
My plugin uses the following code to reference a file, but I've read `WP_PLUGIN_DIR` won't work if a user renames the default plugin folder. I would also like to replace `/location-specific-menu-items/`with a reference to the current plugin folder. ``` $gi = geoip_open(WP_PLUGIN_DIR ."/location-specific-menu-items/Ge...
If the plugin structure is: ``` plugins/ some-plugin/ some-plugin.php data/ GeoIP.dat ``` then for PHP 5.3.0+, you could try the magic constant [`__DIR__`](http://php.net/manual/en/language.constants.predefined.php) > > `__DIR__` The directory of the file. If used inside an include, th...
217,490
<p>I want to get the count of my posts. I think use </p> <p>wp-json/wp/v2/categories?page=1 >> count it's a good way to go. But using above solution is not a cup of tea in term of speed and i don't know how to get all the categories by one call.(if u know it would be so helpful if u share it). is there any way/tutoria...
[ { "answer_id": 236880, "author": "Sdghasemi", "author_id": 101489, "author_profile": "https://wordpress.stackexchange.com/users/101489", "pm_score": 0, "selected": false, "text": "<p>I've spent hours on searching on getting number of posts with WP REST API even v2 through Google and Word...
2016/02/12
[ "https://wordpress.stackexchange.com/questions/217490", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84324/" ]
I want to get the count of my posts. I think use wp-json/wp/v2/categories?page=1 >> count it's a good way to go. But using above solution is not a cup of tea in term of speed and i don't know how to get all the categories by one call.(if u know it would be so helpful if u share it). is there any way/tutorial/... enab...
The WP Rest API sends the total count(**found\_posts**) property from WP\_Query. in a header called **`X-WP-Total`**. **FOR POSTS:** you can make a call to posts endpoint of the REST API ``` http://demo.wp-api.org/wp-json/wp/v2/posts ``` The value for posts count is returned in the header as **`X-WP-Total`**. Belo...
217,503
<p>When I log in to my WordPress blog, there's a checkbox that says <em>Remember me</em>. But whether or not I check this, if I come back in a day or two I have to log in again, so it doesn't appear that this checkbox does anything. (My Google account, by contrast, hasn't ever once asked me to re-login on this comput...
[ { "answer_id": 217504, "author": "Mechow", "author_id": 87922, "author_profile": "https://wordpress.stackexchange.com/users/87922", "pm_score": -1, "selected": false, "text": "<p>Does it require you to type your user name when you come back in a few days? If you have to type that, then y...
2016/02/12
[ "https://wordpress.stackexchange.com/questions/217503", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88604/" ]
When I log in to my WordPress blog, there's a checkbox that says *Remember me*. But whether or not I check this, if I come back in a day or two I have to log in again, so it doesn't appear that this checkbox does anything. (My Google account, by contrast, hasn't ever once asked me to re-login on this computer, for more...
The cookies are set to expire two weeks from the time they are created. From the [codex](https://codex.wordpress.org/WordPress_Cookies) The expiration period is set in `wp-includes/pluggable.php` as shown below: ``` $expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remem...
217,512
<p>When I console.log(wp) the object only includes: -wp.emoji -wp.heartbeat -wp.svgPainter</p> <p>Script is loaded in the footer and last in the DOM. What am I missing?</p>
[ { "answer_id": 217514, "author": "Justin W Hall", "author_id": 11857, "author_profile": "https://wordpress.stackexchange.com/users/11857", "pm_score": 4, "selected": true, "text": "<p>Ah, I get it. When you enqueue your admin script, add 'wp-util' as a dependancy. </p>\n\n<pre><code> ...
2016/02/13
[ "https://wordpress.stackexchange.com/questions/217512", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11857/" ]
When I console.log(wp) the object only includes: -wp.emoji -wp.heartbeat -wp.svgPainter Script is loaded in the footer and last in the DOM. What am I missing?
Ah, I get it. When you enqueue your admin script, add 'wp-util' as a dependancy. ``` wp_enqueue_script( 'script_handle', plugin_dir_url( __FILE__ ) . 'script.js', array( 'jquery', 'wp-util' ), '1.0', true ); ```
217,556
<p>I have a plugin that is creating a few pages and I want to use the custom templates I made for those specific pages. The pages a creating fine and even one of the templates is working but the other isnt. I will mark it but here is the code: </p> <pre><code>function ch_register_pages() { $ch_register_page_title...
[ { "answer_id": 217557, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>Both of your filters return nothing if the conditional doesn't match, so if the first one matches, it's broken by ...
2016/02/13
[ "https://wordpress.stackexchange.com/questions/217556", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/35153/" ]
I have a plugin that is creating a few pages and I want to use the custom templates I made for those specific pages. The pages a creating fine and even one of the templates is working but the other isnt. I will mark it but here is the code: ``` function ch_register_pages() { $ch_register_page_title = 'CH'; $...
I got it. It kind of makes sense but doesnt really. The one template wasnt working becuase I was looking for just the slug. Since its a child of the other page I needed to add it in the `is_page` statement. This worked (I also just did it all in one function): ``` function ch_register_page_template($page_template;) {/...
217,607
<p>Is there any more elegant way to automatically add the parent categories through PHP (not JavaScript) upon registering categories for a post from some custom page?</p> <p>I Add the categories checked with the following code:</p> <pre><code>wp_set_post_terms($post_id, $catarray, 'category'); </code></pre> <p>And t...
[ { "answer_id": 217612, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 2, "selected": false, "text": "<pre><code>function wpse_set_parent_terms($post_id, $post){\n\n $post_type = 'post'; //set the post type yo...
2016/02/14
[ "https://wordpress.stackexchange.com/questions/217607", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/87968/" ]
Is there any more elegant way to automatically add the parent categories through PHP (not JavaScript) upon registering categories for a post from some custom page? I Add the categories checked with the following code: ``` wp_set_post_terms($post_id, $catarray, 'category'); ``` And then to automatically add the pare...
[`wp_set_post_terms()`](https://developer.wordpress.org/reference/functions/wp_set_post_terms/) uses [`wp_set_object_terms()`](https://developer.wordpress.org/reference/functions/wp_set_object_terms/). There is an action hook called [`set_object_terms`](https://developer.wordpress.org/reference/hooks/set_object_terms/)...
217,608
<p>How could I include the following script and stylesheet in a wordpress plugin if they only need to load in the admin panel?</p> <pre><code>&lt;script type="text/javascript" src="/wp-includes/js/jquery/jquery.js?ver=1.11.3"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="assets/chosen.min.css"&gt;...
[ { "answer_id": 217609, "author": "tillinberlin", "author_id": 26059, "author_profile": "https://wordpress.stackexchange.com/users/26059", "pm_score": 1, "selected": false, "text": "<p>There are probably various ways to do this – personally I use the following for loading some small scrip...
2016/02/14
[ "https://wordpress.stackexchange.com/questions/217608", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81557/" ]
How could I include the following script and stylesheet in a wordpress plugin if they only need to load in the admin panel? ``` <script type="text/javascript" src="/wp-includes/js/jquery/jquery.js?ver=1.11.3"></script> <link rel="stylesheet" type="text/css" href="assets/chosen.min.css"> <script type="text/javascript" ...
There are probably various ways to do this – personally I use the following for loading some small scripts only on the "new" and "edit" pages (datepicker etc.): ``` function load_my_admin_scripts( $hook ) { if (( $hook == 'post.php' || $hook == 'post-new.php' )) { wp_enqueue_script( 'my-datepicker', ...
217,646
<p>I want to have different sized previews for different kinds of work I've done. Say 100x100px for regular stuff, but 200x200px for a bigger project.</p> <p>I figure I can use category to sort, and I know how to call that separately, but I don't want to list all the 'premium' stuff first and then the rest later. I wa...
[ { "answer_id": 217609, "author": "tillinberlin", "author_id": 26059, "author_profile": "https://wordpress.stackexchange.com/users/26059", "pm_score": 1, "selected": false, "text": "<p>There are probably various ways to do this – personally I use the following for loading some small scrip...
2016/02/15
[ "https://wordpress.stackexchange.com/questions/217646", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88691/" ]
I want to have different sized previews for different kinds of work I've done. Say 100x100px for regular stuff, but 200x200px for a bigger project. I figure I can use category to sort, and I know how to call that separately, but I don't want to list all the 'premium' stuff first and then the rest later. I want all wor...
There are probably various ways to do this – personally I use the following for loading some small scripts only on the "new" and "edit" pages (datepicker etc.): ``` function load_my_admin_scripts( $hook ) { if (( $hook == 'post.php' || $hook == 'post-new.php' )) { wp_enqueue_script( 'my-datepicker', ...
217,674
<p>I don't know what I'm doing wrong... I'm using the starter timber theme... I'm trying unslider to work with my theme... indicated here is somehow a proof I did right in putting scripts from the function.php... </p> <pre><code>&lt;script type='text/javascript' src='http://localhost/luxjeweler/wp-content/themes/timbe...
[ { "answer_id": 217677, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 1, "selected": false, "text": "<p>Remove this line:</p>\n\n<pre><code>wp_enqueue_script( 'luxjewels-jquery', get_template_directory_uri(...
2016/02/15
[ "https://wordpress.stackexchange.com/questions/217674", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/86161/" ]
I don't know what I'm doing wrong... I'm using the starter timber theme... I'm trying unslider to work with my theme... indicated here is somehow a proof I did right in putting scripts from the function.php... ``` <script type='text/javascript' src='http://localhost/luxjeweler/wp-content/themes/timber-starter-theme-m...
``` $(document).ready(function(){ alert("test"); }); ``` It could be that your jQuery is working in compatibility mode. Try replacing `$` with jQuery: ``` jQuery(document).ready(function(){ alert("test"); }); ``` Edit: As per the author edit on the post: ``` jQuery(document).ready(function(){ jQuery('....
217,675
<p>This shouldn't be so hard! But I cannot find the answer to this question on Google..</p> <p>How can I link from an attachment template to the full post please?</p> <p>Bonus question!</p> <p>How can I grab the custom field data from the post that the attachment belong to on the attachment template?</p> <p>I use t...
[ { "answer_id": 217680, "author": "Mayeenul Islam", "author_id": 22728, "author_profile": "https://wordpress.stackexchange.com/users/22728", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p><em>Q: How can I link from an attachment template to the full post please?</em></p>\n<...
2016/02/15
[ "https://wordpress.stackexchange.com/questions/217675", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10425/" ]
This shouldn't be so hard! But I cannot find the answer to this question on Google.. How can I link from an attachment template to the full post please? Bonus question! How can I grab the custom field data from the post that the attachment belong to on the attachment template? I use this to grab the data on other t...
If the attachment is attached to a post, the post is determined as "post\_parent". So, if you are in the attachement template (attachment.php, image.php, etc): ``` while ( have_posts() ) { the_post(); // Get parent id of current post (get_the_ID() gets id of current post, // whicdh is the attachement, as we are...
217,685
<p>On <a href="http://test.doig.com.au/meyer/" rel="nofollow">this site</a>, I have the following form which allows a visitor to select from a choice of mortgage calculators to use:</p> <pre><code>&lt;select id="dynamic_select" name="cars"&gt; &lt;option value="http://www.visionabacus.com/Finance/Australia/1/SuiteA100...
[ { "answer_id": 217688, "author": "kinjal jethva", "author_id": 88703, "author_profile": "https://wordpress.stackexchange.com/users/88703", "pm_score": 0, "selected": false, "text": "<p>You should get results using below code:</p>\n\n<pre><code>$( \"#dynamic_select\" ).change( function() ...
2016/02/15
[ "https://wordpress.stackexchange.com/questions/217685", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3206/" ]
On [this site](http://test.doig.com.au/meyer/), I have the following form which allows a visitor to select from a choice of mortgage calculators to use: ``` <select id="dynamic_select" name="cars"> <option value="http://www.visionabacus.com/Finance/Australia/1/SuiteA100/640/Borrowing-Power-Calculator.aspx?ID=MFAA">Bor...
It's better to use Iframe in this case. Here is how I will do it. Do you really need the submit button? in this case I do it without submit button, you can change it to your needs. This example codes can be added to your WordPress page through **Text** Tab on editor ``` <style type="text/css"> .hideframe { ...
217,737
<p>I'm running a WordPress 4.4.2. I have one site that's working fine. When I went to set up another site, I got the following error upon trying to save the "general" settings page:</p> <pre><code>Catchable fatal error: Object of class WP_Error could not be converted to string in /{site-url}/wp-includes/formatting.php...
[ { "answer_id": 217728, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p>With this sort of question, the simplest thing to do is to <a href=\"https://codex.wordpress.org/Function_Referenc...
2016/02/15
[ "https://wordpress.stackexchange.com/questions/217737", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/43669/" ]
I'm running a WordPress 4.4.2. I have one site that's working fine. When I went to set up another site, I got the following error upon trying to save the "general" settings page: ``` Catchable fatal error: Object of class WP_Error could not be converted to string in /{site-url}/wp-includes/formatting.php on line 1025'...
If you look at the source code for [`the_author_meta()`](https://developer.wordpress.org/reference/functions/the_author_meta/), it simply, in essence, just echo's the result from [`get_the_author_meta()`](https://developer.wordpress.org/reference/functions/get_the_author_meta/). WordPress has quite a lot of functions ...
217,738
<p>I have a code which calculates estimated reading time of a blog post <em>(feel free to use it as you wish)</em>:</p> <pre><code>function estimated_reading_time( $post ) { $words = str_word_count( strip_tags( $post-&gt;post_content ) ); //Average reading speed of an adult is 200-250 words per minute $m...
[ { "answer_id": 217739, "author": "BillK", "author_id": 87352, "author_profile": "https://wordpress.stackexchange.com/users/87352", "pm_score": 0, "selected": false, "text": "<p>Hook your function to <code>save_post</code>. Use <code>add_post_meta</code> to add the field for a new post o...
2016/02/15
[ "https://wordpress.stackexchange.com/questions/217738", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80903/" ]
I have a code which calculates estimated reading time of a blog post *(feel free to use it as you wish)*: ``` function estimated_reading_time( $post ) { $words = str_word_count( strip_tags( $post->post_content ) ); //Average reading speed of an adult is 200-250 words per minute $minutes = floor( $words /...
You can use the action hook `save_post_{post_type}`, so for the post type 'post' (blog posts) it is: `save_post_post`. For more info see the [codex](https://codex.wordpress.org/Plugin_API/Action_Reference/save_post). ``` add_action( 'save_post_post', 'sw150216_save_reading_time', 10, 3); function sw150216_save_readin...
217,750
<p>Goodevening,</p> <p>i create a CPT (newsletter) and i want to hide from specific pages. I try to do that with many ways, but the newsletter not hide.</p> <p>Edit: I want to hide in page subscribe {slug} and 6677 {id}</p> <p>1) JQuery</p> <pre><code> jQuery(document).ready(function($) { if (window.locat...
[ { "answer_id": 217739, "author": "BillK", "author_id": 87352, "author_profile": "https://wordpress.stackexchange.com/users/87352", "pm_score": 0, "selected": false, "text": "<p>Hook your function to <code>save_post</code>. Use <code>add_post_meta</code> to add the field for a new post o...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217750", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Goodevening, i create a CPT (newsletter) and i want to hide from specific pages. I try to do that with many ways, but the newsletter not hide. Edit: I want to hide in page subscribe {slug} and 6677 {id} 1) JQuery ``` jQuery(document).ready(function($) { if (window.location.pathname == "localhost/mysite/s...
You can use the action hook `save_post_{post_type}`, so for the post type 'post' (blog posts) it is: `save_post_post`. For more info see the [codex](https://codex.wordpress.org/Plugin_API/Action_Reference/save_post). ``` add_action( 'save_post_post', 'sw150216_save_reading_time', 10, 3); function sw150216_save_readin...
217,755
<p>I am trying to build a custom theme for my wordpress site, I am putting it together from a bootstrap theme I found. This is my first foray into developing with php, and I've just finished learning to list posts. Since I have two posts, I haven't bothered to figure out how to break the loop into multiple pages (ie. s...
[ { "answer_id": 217739, "author": "BillK", "author_id": 87352, "author_profile": "https://wordpress.stackexchange.com/users/87352", "pm_score": 0, "selected": false, "text": "<p>Hook your function to <code>save_post</code>. Use <code>add_post_meta</code> to add the field for a new post o...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217755", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88686/" ]
I am trying to build a custom theme for my wordpress site, I am putting it together from a bootstrap theme I found. This is my first foray into developing with php, and I've just finished learning to list posts. Since I have two posts, I haven't bothered to figure out how to break the loop into multiple pages (ie. show...
You can use the action hook `save_post_{post_type}`, so for the post type 'post' (blog posts) it is: `save_post_post`. For more info see the [codex](https://codex.wordpress.org/Plugin_API/Action_Reference/save_post). ``` add_action( 'save_post_post', 'sw150216_save_reading_time', 10, 3); function sw150216_save_readin...
217,778
<p>I am writing a plugin (<a href="https://github.com/uncovery/unc_gallery" rel="nofollow noreferrer">Github Link</a>) and have trouble setting up the titles of the admin menu.</p> <p>I defined a top header menu with add_menu_page (<a href="https://github.com/uncovery/unc_gallery/blob/master/unc_backend.inc.php#L17" re...
[ { "answer_id": 217739, "author": "BillK", "author_id": 87352, "author_profile": "https://wordpress.stackexchange.com/users/87352", "pm_score": 0, "selected": false, "text": "<p>Hook your function to <code>save_post</code>. Use <code>add_post_meta</code> to add the field for a new post o...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217778", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/32482/" ]
I am writing a plugin ([Github Link](https://github.com/uncovery/unc_gallery)) and have trouble setting up the titles of the admin menu. I defined a top header menu with add\_menu\_page ([link to code, same as below](https://github.com/uncovery/unc_gallery/blob/master/unc_backend.inc.php#L17)) and 2 children with add\...
You can use the action hook `save_post_{post_type}`, so for the post type 'post' (blog posts) it is: `save_post_post`. For more info see the [codex](https://codex.wordpress.org/Plugin_API/Action_Reference/save_post). ``` add_action( 'save_post_post', 'sw150216_save_reading_time', 10, 3); function sw150216_save_readin...
217,792
<p>In wordpress we use _e when we have to print things. Example - </p> <pre><code>&lt;div class="col-md-12 col-sm-12 col-xs-12 tuts"&gt; &lt;p&gt;&lt;?php _e( 'We are sorry, but there is nothing here! You might even call this a 404 Page Not Found error message, which is exactly what it is. The page you are looking...
[ { "answer_id": 217793, "author": "Devendra Sharma", "author_id": 70571, "author_profile": "https://wordpress.stackexchange.com/users/70571", "pm_score": -1, "selected": false, "text": "<p>There are my code.you can use.</p>\n\n<pre><code>&lt;?php _e( 'We are sorry, but there is nothing he...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217792", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
In wordpress we use \_e when we have to print things. Example - ``` <div class="col-md-12 col-sm-12 col-xs-12 tuts"> <p><?php _e( 'We are sorry, but there is nothing here! You might even call this a 404 Page Not Found error message, which is exactly what it is. The page you are looking for either does not exist, ...
You can write like below: ``` <?php /* translators: %s: home page URL */ printf( __( 'We are sorry, but there is nothing here! You might even call this a 404 Page Not Found error message, which is exactly what it is. The page you are looking for either does not exist, or the URL you followed or typed to get to it is i...
217,795
<p>I'm working on a checklist within wordpress – I have a huge list of posts and I want to tag them with checks that have been done for the post.</p> <p>However, I want to display all the tags not applied on this post.</p> <p>For example:</p> <hr> <p><strong>Sarah's Document</strong></p> <p>Processes not checked y...
[ { "answer_id": 217793, "author": "Devendra Sharma", "author_id": 70571, "author_profile": "https://wordpress.stackexchange.com/users/70571", "pm_score": -1, "selected": false, "text": "<p>There are my code.you can use.</p>\n\n<pre><code>&lt;?php _e( 'We are sorry, but there is nothing he...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217795", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/27504/" ]
I'm working on a checklist within wordpress – I have a huge list of posts and I want to tag them with checks that have been done for the post. However, I want to display all the tags not applied on this post. For example: --- **Sarah's Document** Processes not checked yet: `ISU-123`, `ISU-124`, `ISU-125` --- **A...
You can write like below: ``` <?php /* translators: %s: home page URL */ printf( __( 'We are sorry, but there is nothing here! You might even call this a 404 Page Not Found error message, which is exactly what it is. The page you are looking for either does not exist, or the URL you followed or typed to get to it is i...
217,809
<p>I cannot for the life of me find the code for this particular item:</p> <p><a href="https://i.stack.imgur.com/jQagI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jQagI.png" alt="enter image description here"></a></p> <p>Usually in other themes there's the link "Edit" on the front page and post...
[ { "answer_id": 217810, "author": "Tribalpixel", "author_id": 11987, "author_profile": "https://wordpress.stackexchange.com/users/11987", "pm_score": 2, "selected": false, "text": "<p>I dont know thoses theme, but in wordpress normaly you use: </p>\n\n<pre><code>edit_post_link()\nedit_com...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217809", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/288/" ]
I cannot for the life of me find the code for this particular item: [![enter image description here](https://i.stack.imgur.com/jQagI.png)](https://i.stack.imgur.com/jQagI.png) Usually in other themes there's the link "Edit" on the front page and post page to directly go to edit the post in admin panel. However, in th...
This should be located in the `entry-meta.php` file of the parent theme (kuorinka). Here is the code: ``` <?php if ( 'post' == get_post_type() ) : ?> <div class="entry-meta"> <!-- Date & Author name--> <?php kuorinka_posted_on(); ?> <!-- Comments count --> <?php if ( ! post_password...
217,812
<p>I have my calendar events, I want to sort them by creation date with the query, but here's the issue:</p> <p>I have a meta key which has child values: First one is <code>$data = get_post_meta(get_the_ID(),'_event_data',true);</code> and then I get <code>$date = $data['begin'];</code></p> <p>I need to make the quer...
[ { "answer_id": 217810, "author": "Tribalpixel", "author_id": 11987, "author_profile": "https://wordpress.stackexchange.com/users/11987", "pm_score": 2, "selected": false, "text": "<p>I dont know thoses theme, but in wordpress normaly you use: </p>\n\n<pre><code>edit_post_link()\nedit_com...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217812", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88796/" ]
I have my calendar events, I want to sort them by creation date with the query, but here's the issue: I have a meta key which has child values: First one is `$data = get_post_meta(get_the_ID(),'_event_data',true);` and then I get `$date = $data['begin'];` I need to make the query sort based on the `$date = $data['beg...
This should be located in the `entry-meta.php` file of the parent theme (kuorinka). Here is the code: ``` <?php if ( 'post' == get_post_type() ) : ?> <div class="entry-meta"> <!-- Date & Author name--> <?php kuorinka_posted_on(); ?> <!-- Comments count --> <?php if ( ! post_password...
217,820
<p>After a lengthy break from WP i'm getting my hands dirty with quite a complex plugin which is coming along nicely, but right now i am at the point of needing some advice on quite a complex issue:</p> <p><strong>Project Outline</strong> Plugin is multi-functional with the core element being that it is a members base...
[ { "answer_id": 217810, "author": "Tribalpixel", "author_id": 11987, "author_profile": "https://wordpress.stackexchange.com/users/11987", "pm_score": 2, "selected": false, "text": "<p>I dont know thoses theme, but in wordpress normaly you use: </p>\n\n<pre><code>edit_post_link()\nedit_com...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217820", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3710/" ]
After a lengthy break from WP i'm getting my hands dirty with quite a complex plugin which is coming along nicely, but right now i am at the point of needing some advice on quite a complex issue: **Project Outline** Plugin is multi-functional with the core element being that it is a members based system focused on onl...
This should be located in the `entry-meta.php` file of the parent theme (kuorinka). Here is the code: ``` <?php if ( 'post' == get_post_type() ) : ?> <div class="entry-meta"> <!-- Date & Author name--> <?php kuorinka_posted_on(); ?> <!-- Comments count --> <?php if ( ! post_password...
217,828
<p>Which is the best approach to hide WordPress, preferably everything from folders and files, to admin login ? I'm pretty new to that stuff, so I'll prefer a plugin ratter a custom code, unless it's easy enough to set-it up. </p>
[ { "answer_id": 217833, "author": "rob_st", "author_id": 29055, "author_profile": "https://wordpress.stackexchange.com/users/29055", "pm_score": 1, "selected": false, "text": "<p>Well, it depends what you mean by \"hide\" and what you're going to approach.</p>\n\n<p>Hiding folders and fil...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217828", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88807/" ]
Which is the best approach to hide WordPress, preferably everything from folders and files, to admin login ? I'm pretty new to that stuff, so I'll prefer a plugin ratter a custom code, unless it's easy enough to set-it up.
If you are new to php and mod\_rewrite i suggest so you check with the section of my response. Or if you keen to try it yourself, you can use something like this to hide the wp-content/plugins path structure: ``` <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^modules/(.*) /wp-content/plugins/$1 [L,QSA] </IfMod...
217,847
<p>I'd like to exclude categories from <a href="https://codex.wordpress.org/Template_Tags/wp_list_categories" rel="nofollow"><code>wp_list_categories()</code></a> but I want to use the category slug because I do development on a local install where the category ID will be different in production. I got this to work wit...
[ { "answer_id": 217853, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 1, "selected": false, "text": "<p>Instead of getting <em>all</em> categories you could just loop through your excluded slug array and use <a ...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217847", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/86078/" ]
I'd like to exclude categories from [`wp_list_categories()`](https://codex.wordpress.org/Template_Tags/wp_list_categories) but I want to use the category slug because I do development on a local install where the category ID will be different in production. I got this to work with the following code: ``` $exclcat ...
I would suggest a cleaner approach would be to implement an `exclude_slugs` argument for the function, then you can just use the following in your template code: ``` wp_list_categories([ 'exclude_slugs' => [ 'fp-feature', 'fp-aside-feature' ], // Other arguments ]); ``` Here's the filter, pop it in your `fu...
217,875
<p>When I try to use the Flexslider with 'built-in' jquery, the Flexslider won't work. When I use my own <strong>myjquery</strong> file, It works as if nothing ever.<br> Do I always have to use my own jquery file even wordpress has its own?</p> <ul> <li>Wordpress' (built in) jQuery vserion: 1.11.3 </li> <li>Flexbox r...
[ { "answer_id": 217901, "author": "Megan Rose", "author_id": 84643, "author_profile": "https://wordpress.stackexchange.com/users/84643", "pm_score": 0, "selected": false, "text": "<p>First off, you should be registering your scripts in the same function that you enqueue them with. </p>\n\...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217875", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/70809/" ]
When I try to use the Flexslider with 'built-in' jquery, the Flexslider won't work. When I use my own **myjquery** file, It works as if nothing ever. Do I always have to use my own jquery file even wordpress has its own? * Wordpress' (built in) jQuery vserion: 1.11.3 * Flexbox required jQuery version: 1.7+ * **myjq...
The problem was jquery conflict (error `$ is not a function`). All custom scripts should be running in no-conflict mode. I've used `jQuery(...)` instead of `$()`.
217,880
<p>Wordpress should always allow me to change the language, anytime. However, sometimes I get stuck in these kind of situations, where I only get to choose "English (United States)".</p> <p><em>(Settings > General Settings > Site Language)</em></p> <h2>What I expect:</h2> <p><img src="https://i.imgur.com/lJolMVV.png...
[ { "answer_id": 230379, "author": "Roberto Cinetto", "author_id": 59622, "author_profile": "https://wordpress.stackexchange.com/users/59622", "pm_score": 0, "selected": false, "text": "<p>I've solved this issue defining the right way wordpress search for the <code>wp-content</code> folder...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217880", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88841/" ]
Wordpress should always allow me to change the language, anytime. However, sometimes I get stuck in these kind of situations, where I only get to choose "English (United States)". *(Settings > General Settings > Site Language)* What I expect: -------------- ![a](https://i.imgur.com/lJolMVV.png) What I get: --------...
Maybe WordPress doesn't have permissions to save the new language files. I had the same problem, and I solved it by adding the following to `wp-config.php` ``` define('FS_METHOD', 'direct'); ``` You might also want to check that your `wp-content/`-directory is writable for the web server user.
217,881
<p>I need to remove all theme <em>(both child and parent)</em> css styles from a singular page using functions.php in a child theme. Here's what I'm currently adding to the child's functions.php</p> <pre><code>// import parent and child theme css function theme_enqueue_styles() { wp_enqueue_style('parent-style', get_t...
[ { "answer_id": 217892, "author": "Cai", "author_id": 81652, "author_profile": "https://wordpress.stackexchange.com/users/81652", "pm_score": 4, "selected": true, "text": "<p>You can use <a href=\"https://codex.wordpress.org/Conditional_Tags\" rel=\"noreferrer\">conditional tags</a> to ta...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217881", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78266/" ]
I need to remove all theme *(both child and parent)* css styles from a singular page using functions.php in a child theme. Here's what I'm currently adding to the child's functions.php ``` // import parent and child theme css function theme_enqueue_styles() { wp_enqueue_style('parent-style', get_template_directory_uri...
You can use [conditional tags](https://codex.wordpress.org/Conditional_Tags) to target the specific page you need to remove the styles on. You can use `is_page()` to target a *page* page (as opposed to another post type) and pass a page ID, slug, title, or no argument to target *any* page. ``` function wpse_217881_rem...
217,882
<p>I'm trying to stylise my navigation menu regarding selected page.</p> <p>I made a page for news, but when I click on the following pages (page 2 for example), the navigation menu loses its class. I want it retains its <code>current-item-menu</code> class on this case.</p> <p>How can I do this ?</p> <p>Thanks for ...
[ { "answer_id": 217892, "author": "Cai", "author_id": 81652, "author_profile": "https://wordpress.stackexchange.com/users/81652", "pm_score": 4, "selected": true, "text": "<p>You can use <a href=\"https://codex.wordpress.org/Conditional_Tags\" rel=\"noreferrer\">conditional tags</a> to ta...
2016/02/16
[ "https://wordpress.stackexchange.com/questions/217882", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88843/" ]
I'm trying to stylise my navigation menu regarding selected page. I made a page for news, but when I click on the following pages (page 2 for example), the navigation menu loses its class. I want it retains its `current-item-menu` class on this case. How can I do this ? Thanks for your help !
You can use [conditional tags](https://codex.wordpress.org/Conditional_Tags) to target the specific page you need to remove the styles on. You can use `is_page()` to target a *page* page (as opposed to another post type) and pass a page ID, slug, title, or no argument to target *any* page. ``` function wpse_217881_rem...
217,897
<p>I've been adding all the <em>"recommended"</em> <strong>schema.org</strong> markup to my sites for awhile now. Most of the schema markup <a href="https://developers.google.com/structured-data/" rel="nofollow">adds value to google searches</a>. </p> <p>There's other markup though that I've been using and I'm not rea...
[ { "answer_id": 217892, "author": "Cai", "author_id": 81652, "author_profile": "https://wordpress.stackexchange.com/users/81652", "pm_score": 4, "selected": true, "text": "<p>You can use <a href=\"https://codex.wordpress.org/Conditional_Tags\" rel=\"noreferrer\">conditional tags</a> to ta...
2016/02/17
[ "https://wordpress.stackexchange.com/questions/217897", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38123/" ]
I've been adding all the *"recommended"* **schema.org** markup to my sites for awhile now. Most of the schema markup [adds value to google searches](https://developers.google.com/structured-data/). There's other markup though that I've been using and I'm not really sure who actually uses it (search engines, other sit...
You can use [conditional tags](https://codex.wordpress.org/Conditional_Tags) to target the specific page you need to remove the styles on. You can use `is_page()` to target a *page* page (as opposed to another post type) and pass a page ID, slug, title, or no argument to target *any* page. ``` function wpse_217881_rem...
217,932
<p>I have written some long descriptions for a custom category taxonomy. I don't want to remove them, I just want to hide it from the management page:</p> <pre><code>/wp-admin/term.php?taxonomy=custom_category </code></pre> <p>I could use CSS to hide the class "column-description", but I don't know how to only apply ...
[ { "answer_id": 217934, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 4, "selected": true, "text": "<p>You could target the edit form for the <em>post_tag</em> taxonomy, through the <code>post_tag_edit_form</code>...
2016/02/17
[ "https://wordpress.stackexchange.com/questions/217932", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/190834/" ]
I have written some long descriptions for a custom category taxonomy. I don't want to remove them, I just want to hide it from the management page: ``` /wp-admin/term.php?taxonomy=custom_category ``` I could use CSS to hide the class "column-description", but I don't know how to only apply it to this taxonomy.
You could target the edit form for the *post\_tag* taxonomy, through the `post_tag_edit_form` hook: ``` /** * Hide the term description in the post_tag edit form */ add_action( "post_tag_edit_form", function( $tag, $taxonomy ) { ?><style>.term-description-wrap{display:none;}</style><?php }, 10, 2 ); ``` Here ...
217,954
<p>I'm in the process of creating my first theme, and I'm using Quark as a starter theme.</p> <p>I would like the theme to have various options, one being header selection. (let's say 5 different headers - when selected, the header will show site wide.)</p> <p>I also would like to implement various headers whose code...
[ { "answer_id": 217968, "author": "тнє Sufi", "author_id": 28744, "author_profile": "https://wordpress.stackexchange.com/users/28744", "pm_score": 0, "selected": false, "text": "<p>With Option Tree, you can use it like this way:</p>\n\n<p>Lets say you will provide 5 different header desig...
2016/02/17
[ "https://wordpress.stackexchange.com/questions/217954", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37147/" ]
I'm in the process of creating my first theme, and I'm using Quark as a starter theme. I would like the theme to have various options, one being header selection. (let's say 5 different headers - when selected, the header will show site wide.) I also would like to implement various headers whose code are available on...
So first you need customizer options. You can put this in `customizer.php` and include that file in your `functions.php` or you can just put it in `functions.php` directly. ``` add_action('customize_register', 'mytheme_customize_register'); function mytheme_customize_register( $wp_customize ) { /** ---------...
217,960
<p>I installed wp 4.2.2 on xampp localhost - multisite, following this article <a href="https://premium.wpmudev.org/blog/setting-up-xampp/" rel="nofollow">https://premium.wpmudev.org/blog/setting-up-xampp/</a></p> <p>xampp is surely ok, because it works a year without a problem.</p> <p>The new installation is wordpre...
[ { "answer_id": 217968, "author": "тнє Sufi", "author_id": 28744, "author_profile": "https://wordpress.stackexchange.com/users/28744", "pm_score": 0, "selected": false, "text": "<p>With Option Tree, you can use it like this way:</p>\n\n<p>Lets say you will provide 5 different header desig...
2016/02/17
[ "https://wordpress.stackexchange.com/questions/217960", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/25574/" ]
I installed wp 4.2.2 on xampp localhost - multisite, following this article <https://premium.wpmudev.org/blog/setting-up-xampp/> xampp is surely ok, because it works a year without a problem. The new installation is wordpress only. Installation seems ok, but starting dashboard - Appearance - Themes I can see just cu...
So first you need customizer options. You can put this in `customizer.php` and include that file in your `functions.php` or you can just put it in `functions.php` directly. ``` add_action('customize_register', 'mytheme_customize_register'); function mytheme_customize_register( $wp_customize ) { /** ---------...
218,005
<p>I'm sure this must be super simple, but Google isn't helping me!</p> <p>I am using an up-to-date WordPress and I have a two-column layout on my blog section (content left, Twitter feed right) that I am very happy with. This was created using just the <code>Appearance &gt; Widgets</code> page. </p> <p>Now I want to...
[ { "answer_id": 217968, "author": "тнє Sufi", "author_id": 28744, "author_profile": "https://wordpress.stackexchange.com/users/28744", "pm_score": 0, "selected": false, "text": "<p>With Option Tree, you can use it like this way:</p>\n\n<p>Lets say you will provide 5 different header desig...
2016/02/17
[ "https://wordpress.stackexchange.com/questions/218005", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/86612/" ]
I'm sure this must be super simple, but Google isn't helping me! I am using an up-to-date WordPress and I have a two-column layout on my blog section (content left, Twitter feed right) that I am very happy with. This was created using just the `Appearance > Widgets` page. Now I want to use the exact same layout for ...
So first you need customizer options. You can put this in `customizer.php` and include that file in your `functions.php` or you can just put it in `functions.php` directly. ``` add_action('customize_register', 'mytheme_customize_register'); function mytheme_customize_register( $wp_customize ) { /** ---------...
218,025
<p>I wish to remove the author's links to their original website, from my page</p> <p>I know this is in either the functions.php or comments.php files.</p> <p>I'm not sure exactly of how to edit these php files, </p> <p>I've come across some code online that basically states that I must insert the following. But I a...
[ { "answer_id": 218028, "author": "jepser", "author_id": 6519, "author_profile": "https://wordpress.stackexchange.com/users/6519", "pm_score": -1, "selected": false, "text": "<p>If I understand what do you want to make, paste this in your functions.php</p>\n\n<pre><code>function alter_com...
2016/02/18
[ "https://wordpress.stackexchange.com/questions/218025", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88910/" ]
I wish to remove the author's links to their original website, from my page I know this is in either the functions.php or comments.php files. I'm not sure exactly of how to edit these php files, I've come across some code online that basically states that I must insert the following. But I am not sure where exactly...
Add following code snippet in `functions.php`. (*in your `theme`folder*) **Edit new code:** - *This should do the trick, sorry for the delay.* ``` /** * Remove post author link on comments * * @return string $author */ function wpse218025_remove_comment_author_link( $return, $author, $comment_ID ) { retur...
218,036
<p>how can i display in my theme all woocommerce category title are custom filed value. </p> <p>example html like bellow </p> <pre><code>&lt;li&gt;&lt;a href="#"&gt; &lt;div&gt; &lt;h2&gt;category title&lt;/h5&gt; &lt;h3&gt;custom field one value&lt;/h6&gt; &lt;/div&gt; ...
[ { "answer_id": 218043, "author": "Adam", "author_id": 13418, "author_profile": "https://wordpress.stackexchange.com/users/13418", "pm_score": 1, "selected": false, "text": "<pre><code>&lt;?php\n\n$post_type = 'product';\n\n$taxonomies = get_object_taxonomies((object) array( 'post_type' =...
2016/02/18
[ "https://wordpress.stackexchange.com/questions/218036", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/87838/" ]
how can i display in my theme all woocommerce category title are custom filed value. example html like bellow ``` <li><a href="#"> <div> <h2>category title</h5> <h3>custom field one value</h6> </div> <div class="imgpos">custom field two value</div> </a...
``` <?php $post_type = 'product'; $taxonomies = get_object_taxonomies((object) array( 'post_type' => $post_type )); foreach ($taxonomies as $taxonomy) : $terms = get_terms($taxonomy); foreach ($terms as $term) : $term_link = get_term_link($term->term_id); $posts = new WP_Query( "taxonom...
218,049
<p>I'm building my own website within WordPress from scratch. It's not really a new theme, just everything from the beginning, starting with an index file, header, footer, single, comments, functions etc. Utilizing WordPress' features where ever I need them.</p> <p>I've always been doing good at that, except from when...
[ { "answer_id": 218087, "author": "Charles", "author_id": 15605, "author_profile": "https://wordpress.stackexchange.com/users/15605", "pm_score": 4, "selected": true, "text": "<p>Maybe this helps you out?<br />\nPlease make a backup from <code>functions.php</code> and add following <code>...
2016/02/18
[ "https://wordpress.stackexchange.com/questions/218049", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88957/" ]
I'm building my own website within WordPress from scratch. It's not really a new theme, just everything from the beginning, starting with an index file, header, footer, single, comments, functions etc. Utilizing WordPress' features where ever I need them. I've always been doing good at that, except from when I discove...
Maybe this helps you out? Please make a backup from `functions.php` and add following `function`. ``` /** * Add .js script if "Enable threaded comments" is activated in Admin * Codex: {@link https://developer.wordpress.org/reference/functions/wp_enqueue_script/} */ function wpse218049_enqueue_comments_reply() { ...
218,057
<p>I've written a custom theme. It's pretty complex so I won't post a huge code block here for everyone's sanity.</p> <p>In my <code>functions.php</code> file I have the following hook being called:</p> <pre><code>function DA_script_enqueue() { if( is_404() ){ //load scripts with wp_enqueue_script() ...
[ { "answer_id": 218147, "author": "Stephen", "author_id": 85039, "author_profile": "https://wordpress.stackexchange.com/users/85039", "pm_score": 1, "selected": false, "text": "<p>As a partial answer to your question, I can explain your confusion over deleting the header file. The <code>w...
2016/02/18
[ "https://wordpress.stackexchange.com/questions/218057", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/36192/" ]
I've written a custom theme. It's pretty complex so I won't post a huge code block here for everyone's sanity. In my `functions.php` file I have the following hook being called: ``` function DA_script_enqueue() { if( is_404() ){ //load scripts with wp_enqueue_script() } if( is_search() ){ ...
When using `wp_enqueue_script`, you probably passing `true` for `in_footer` parameter. If so, then check that your `search.php` is calling `get_footer()` function at the bottom.
218,064
<p>I'm trying to retrieve the posts of specific taxonomy categories. I have two taxonomy categories.</p> <ol> <li>Category One</li> <li>Category Two</li> </ol> <p>In these two have some different and same posts. So when i retrieve the data through <code>terms id</code> then query return some post two times, because t...
[ { "answer_id": 218069, "author": "N00b", "author_id": 80903, "author_profile": "https://wordpress.stackexchange.com/users/80903", "pm_score": 3, "selected": true, "text": "<p>You should never use <code>WP_Query</code> inside that kind of loop <em>(there might be few exceptions but not in...
2016/02/18
[ "https://wordpress.stackexchange.com/questions/218064", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88873/" ]
I'm trying to retrieve the posts of specific taxonomy categories. I have two taxonomy categories. 1. Category One 2. Category Two In these two have some different and same posts. So when i retrieve the data through `terms id` then query return some post two times, because these posts are link from above two categorie...
You should never use `WP_Query` inside that kind of loop *(there might be few exceptions but not in your case)* because you can do most things with one query. This [codex link](https://codex.wordpress.org/Class_Reference/WP_Query) has everything related to `WP_Query` with explanations and very simple examples. If taxo...
218,081
<p>I have the following code used to create a Custom Post Type. All works the save function is being triggered, and it seems to be saving. But I cannot get the saved data to output in the text field on Page Edit. I've stared at this and played around with it for days now. Looked at every tutorial online. I can't figure...
[ { "answer_id": 218089, "author": "Tom Kentell", "author_id": 88813, "author_profile": "https://wordpress.stackexchange.com/users/88813", "pm_score": -1, "selected": true, "text": "<p>Based on the amount of times you missed the c from the word project... my first recommendation would be t...
2016/02/18
[ "https://wordpress.stackexchange.com/questions/218081", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1354/" ]
I have the following code used to create a Custom Post Type. All works the save function is being triggered, and it seems to be saving. But I cannot get the saved data to output in the text field on Page Edit. I've stared at this and played around with it for days now. Looked at every tutorial online. I can't figure ou...
Based on the amount of times you missed the c from the word project... my first recommendation would be to check for typos in your code/file names :) Try updating permalinks in here: /wp-admin/options-permalink.php. Just hit update, and see if that solves the problem. Also, see if any errors are getting reported, ope...
218,137
<p>I am retrieving taxonomy terms. The code is working.<br> Foreach creates three options for the select tag. There are three terms. But, when I wanted to echo "selected" for each options, after selecting one. it returns odd result. What is the problem? Here is the code. </p> <pre><code>$terms = get_terms( 'departmen...
[ { "answer_id": 218140, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 4, "selected": true, "text": "<p>WordPress doesn't track if a user is online. It can only know if the current is online, which is always yes (...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218137", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88854/" ]
I am retrieving taxonomy terms. The code is working. Foreach creates three options for the select tag. There are three terms. But, when I wanted to echo "selected" for each options, after selecting one. it returns odd result. What is the problem? Here is the code. ``` $terms = get_terms( 'department' ); if ( !...
WordPress doesn't track if a user is online. It can only know if the current is online, which is always yes ( else there would be no request ). If you want to know if a different user that isn't the current user is online, that information doesn't exist, and you'll need to implement it yourself. `is_user_logged_in` ch...
218,149
<p>I have a self-hosted WordPress blog, and for weeks someone has been trying log in as admin. I'm looking for a way to stop it. Since I started blocking the originating IP address, the attempts started coming from many IPs but in batches of three or four tries at 10 minute intervals - so it's obviously one person and...
[ { "answer_id": 218152, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 2, "selected": false, "text": "<blockquote>\n <p><a href=\"https://m.youtube.com/watch?v=YRzg8XrvT3g\" rel=\"nofollow\">You can run, but...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218149", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89014/" ]
I have a self-hosted WordPress blog, and for weeks someone has been trying log in as admin. I'm looking for a way to stop it. Since I started blocking the originating IP address, the attempts started coming from many IPs but in batches of three or four tries at 10 minute intervals - so it's obviously one person and I g...
One thing you can do is if you don't have membership website then make it such that wp-admin/wp-login can be open through your IP address and block all other IP address. But make sure that you don't have membership website (No other subscribers/publishers that can login. Only you are the person to log in.) The other t...
218,169
<p>I've been trying to change my <code>WP_Query</code> to <code>get_posts</code> methods. But I am not really sure how to check if <code>get_posts</code> is null or have a value.</p> <p>How can i transform this <code>WP_Query</code> checker to appropriate <code>get_posts</code> checker?</p> <p>This is my <code>WP_Que...
[ { "answer_id": 218170, "author": "Sumit", "author_id": 32475, "author_profile": "https://wordpress.stackexchange.com/users/32475", "pm_score": 2, "selected": false, "text": "<p>Using a simple <code>empty</code> function.</p>\n\n<pre><code>$wpse_posts = get_posts( $args );\n\nif ( ! empty...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218169", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88947/" ]
I've been trying to change my `WP_Query` to `get_posts` methods. But I am not really sure how to check if `get_posts` is null or have a value. How can i transform this `WP_Query` checker to appropriate `get_posts` checker? This is my `WP_Query` checker: ``` $custom_query = new WP_Query($args); if ( $custom_query->ha...
From previous questions, I know you would want optimize your queries. There is no need to change `WP_Query` into `get_posts` for perfomance. As I stated in a another post, yes, `get_posts()` is faster than `WP_Query` because `get_posts()` legally breaks pagination, but what `get_posts()` do can be done with `WP_Query`....
218,174
<p>I have create a form and i want to store the form data in <code>wp_options</code> table so for that i have created this query</p> <pre><code>$insertquery = $wpdb-&gt;query("INSERT INTO `wp_options`(`option_name`,`option_value`) VALUES ('smsfactory123','asdasdf')"); </code></pre> <p>Now when i am importing the stat...
[ { "answer_id": 218176, "author": "Devendra Sharma", "author_id": 70571, "author_profile": "https://wordpress.stackexchange.com/users/70571", "pm_score": 1, "selected": false, "text": "<p>You can save array with update_option function like below code.</p>\n\n<pre><code>update_option('opti...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218174", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88914/" ]
I have create a form and i want to store the form data in `wp_options` table so for that i have created this query ``` $insertquery = $wpdb->query("INSERT INTO `wp_options`(`option_name`,`option_value`) VALUES ('smsfactory123','asdasdf')"); ``` Now when i am importing the static data then it doesn't create any probl...
You could also use `json_encode()` function instead of `serialize`. ``` $var = json_encode($array); update_option('option_name', $var); ```
218,178
<p>I've been thinking of using <code>WP_Query</code>'s pagination to make a custom lazy loading. is there a way to utilize the <code>WP_Query</code>'s pagination for a lazy load?</p> <p>Say for example, I have to load 24 posts in the first load, and when the scroll reach bottom it will lazy load the next 24 post.</p> ...
[ { "answer_id": 218209, "author": "N00b", "author_id": 80903, "author_profile": "https://wordpress.stackexchange.com/users/80903", "pm_score": 3, "selected": true, "text": "<p>Take a look at this rough example. This requires a little bit of adaptation but as a whole, it does what you want...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218178", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88947/" ]
I've been thinking of using `WP_Query`'s pagination to make a custom lazy loading. is there a way to utilize the `WP_Query`'s pagination for a lazy load? Say for example, I have to load 24 posts in the first load, and when the scroll reach bottom it will lazy load the next 24 post. Is this possible?
Take a look at this rough example. This requires a little bit of adaptation but as a whole, it does what you want - it loads X amount of next posts if user clicks a button which should be below already loaded posts. If you want to automatically load more posts if user scrolls down, just replace click event with some o...
218,186
<p>I want to use some of the Wordpress API built in functions such as wp_remote_request(). I have tried using this in a php file in my root Wordpress installation but I am just getting an error: </p> <blockquote> <p>Fatal error: Call to undefined function wp_remote_request() in /home/pacekuwa/public_html/gf.php on...
[ { "answer_id": 218245, "author": "Ramūnas Pabrėža", "author_id": 84687, "author_profile": "https://wordpress.stackexchange.com/users/84687", "pm_score": 1, "selected": false, "text": "<p>Wordpress functions are used in theme or plugin files. If you want to use wordpress functions in cust...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218186", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17930/" ]
I want to use some of the Wordpress API built in functions such as wp\_remote\_request(). I have tried using this in a php file in my root Wordpress installation but I am just getting an error: > > Fatal error: Call to undefined function wp\_remote\_request() in > /home/pacekuwa/public\_html/gf.php on line 23 > > ...
You can [create a plugin](https://codex.wordpress.org/Writing_a_Plugin) to contain your code. The [`admin_post_` action](https://codex.wordpress.org/Plugin_API/Action_Reference/admin_post_(action)) can be used to trigger a request handler. WordPress core will be loaded, and the API will work. ``` <?php /* Plugin Name:...
218,194
<p>Hi i want to know can i create two <code>tables</code> while installing my custom plugin. This is the way i am creating the <code>tables</code> in database</p> <pre><code> function wnm_install(){ global $wpdb; global $wnm_db_version; $sms_table = $wpdb-&gt;prefix . "smsfactory"; if($wpdb-&gt;get_var("show tables...
[ { "answer_id": 218198, "author": "Steven", "author_id": 1447, "author_profile": "https://wordpress.stackexchange.com/users/1447", "pm_score": 3, "selected": true, "text": "<p>Seems to me you are just executing one query: <code>dbDelta($sql);</code>.</p>\n\n<p>Have you tried adding <code>...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218194", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88914/" ]
Hi i want to know can i create two `tables` while installing my custom plugin. This is the way i am creating the `tables` in database ``` function wnm_install(){ global $wpdb; global $wnm_db_version; $sms_table = $wpdb->prefix . "smsfactory"; if($wpdb->get_var("show tables like '". $sms_table . "'") != $sms_table)...
Seems to me you are just executing one query: `dbDelta($sql);`. Have you tried adding `dbDelta($sql_sms_table);`?
218,200
<p>I want to put a variable between two tags, but it puts him out.</p> <p>This is my function: (function.php)</p> <pre><code>/* traer thumb */ function item_thumb() { global $post; if (has_post_format('video')) { $key_1_value = get_post_meta( $post-&gt;ID, 'video', true ); if (!empty( $key_1_value ) ) ...
[ { "answer_id": 218201, "author": "Steven", "author_id": 1447, "author_profile": "https://wordpress.stackexchange.com/users/1447", "pm_score": 1, "selected": false, "text": "<p>It's because you are using <a href=\"https://developer.wordpress.org/reference/functions/the_post_thumbnail/\" r...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218200", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/87880/" ]
I want to put a variable between two tags, but it puts him out. This is my function: (function.php) ``` /* traer thumb */ function item_thumb() { global $post; if (has_post_format('video')) { $key_1_value = get_post_meta( $post->ID, 'video', true ); if (!empty( $key_1_value ) ) { $post_video = '<...
`the_post_thumbnail()` echoes data immediate, what you want to try is `get_the_post_thumbnail()` which returns data so that you may concatenate properly. WordPress core functions that are prefixed with `the_` usually echo, those prefixed with `get_` usually return. See: * <https://developer.wordpress.org/reference/f...
218,204
<p>I know that password_reset hooks:</p> <pre><code>Runs after the user submits a new password during password reset but before the new password is actually set. </code></pre> <p>but there is a similar hook <em>AFTER</em> the new password is actually set?</p> <p>EDIT: It would be logical to use profile_update but ...
[ { "answer_id": 218211, "author": "Steven", "author_id": 1447, "author_profile": "https://wordpress.stackexchange.com/users/1447", "pm_score": 2, "selected": false, "text": "<p>It seems that you have to use <code>profile_update</code> hook.</p>\n\n<p>There is a similar question <a href=\"...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218204", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71652/" ]
I know that password\_reset hooks: ``` Runs after the user submits a new password during password reset but before the new password is actually set. ``` but there is a similar hook *AFTER* the new password is actually set? EDIT: It would be logical to use profile\_update but I tried, and profile\_update seems not...
I wonder if you're looking for [this one](https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/user.php#L2086): ``` /** * Fires after the user's password is reset. * * @since 4.4.0 * * @param object $user The user. * @param string $new_pass New user password. */ do_action( 'after_pa...
218,221
<p>I want to get the slug of the current archive page. I have a slider where I want to echo the products that are in this category. After hours this is all I have and it doesn't work...</p> <pre><code>&lt;?php if ( is_single() ) { $cats = get_the_category(); $cat = $cats[0]; // let's just assume the post ha...
[ { "answer_id": 218211, "author": "Steven", "author_id": 1447, "author_profile": "https://wordpress.stackexchange.com/users/1447", "pm_score": 2, "selected": false, "text": "<p>It seems that you have to use <code>profile_update</code> hook.</p>\n\n<p>There is a similar question <a href=\"...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218221", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84738/" ]
I want to get the slug of the current archive page. I have a slider where I want to echo the products that are in this category. After hours this is all I have and it doesn't work... ``` <?php if ( is_single() ) { $cats = get_the_category(); $cat = $cats[0]; // let's just assume the post has one category } ...
I wonder if you're looking for [this one](https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/user.php#L2086): ``` /** * Fires after the user's password is reset. * * @since 4.4.0 * * @param object $user The user. * @param string $new_pass New user password. */ do_action( 'after_pa...
218,237
<p>I want to change the upload directory for Wordpress from <code>project.dev/wp-content/uploads</code> to <code>cdn.project.dev</code></p> <p>Where subdomain <strong>cdn</strong> has DocumentRoot: <code>HostPath/project.dev/cdn</code> while Wordpress is located at <code>HostPath/project.dev/public_html</code></p> <p...
[ { "answer_id": 218211, "author": "Steven", "author_id": 1447, "author_profile": "https://wordpress.stackexchange.com/users/1447", "pm_score": 2, "selected": false, "text": "<p>It seems that you have to use <code>profile_update</code> hook.</p>\n\n<p>There is a similar question <a href=\"...
2016/02/19
[ "https://wordpress.stackexchange.com/questions/218237", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I want to change the upload directory for Wordpress from `project.dev/wp-content/uploads` to `cdn.project.dev` Where subdomain **cdn** has DocumentRoot: `HostPath/project.dev/cdn` while Wordpress is located at `HostPath/project.dev/public_html` Any help is much appreciated.
I wonder if you're looking for [this one](https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/user.php#L2086): ``` /** * Fires after the user's password is reset. * * @since 4.4.0 * * @param object $user The user. * @param string $new_pass New user password. */ do_action( 'after_pa...
218,286
<p>I'm using option tree for my theme options page. But I can't retrieve uploaded images attribute like alternative text, description,caption etc. </p> <p>How can I do that.</p>
[ { "answer_id": 230701, "author": "asadadin", "author_id": 97157, "author_profile": "https://wordpress.stackexchange.com/users/97157", "pm_score": 3, "selected": true, "text": "<p>Put this code in <code>index.php</code></p>\n\n<hr>\n\n<pre><code>&lt;img class=\"img-resposive\" src=\"&lt;?...
2016/02/20
[ "https://wordpress.stackexchange.com/questions/218286", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68186/" ]
I'm using option tree for my theme options page. But I can't retrieve uploaded images attribute like alternative text, description,caption etc. How can I do that.
Put this code in `index.php` --- ``` <img class="img-resposive" src="<?php $logo=get_option_tree( 'logo','','true'); // return src of img $id_logo = get_attachment_id_from_src($logo); // This is custom function for getting image id. $alt = get_post_meta($id_logo, '_wp_attachment_image_alt', true);// get...
218,390
<p>I was using this code:</p> <pre><code>add_filter( 'pre_get_posts','search_only_blog_posts' ); function search_only_blog_posts( $query ) { if ( $query-&gt;is_search ) { $query-&gt;set( 'post_type', 'post' ); } return $query; } </code></pre> <hr> <p>..until I realized that it applies to prett...
[ { "answer_id": 218434, "author": "Nik", "author_id": 89023, "author_profile": "https://wordpress.stackexchange.com/users/89023", "pm_score": -1, "selected": false, "text": "<p>Please Refer this code and setting <a href=\"http://www.wpbeginner.com/wp-tutorials/how-to-exclude-pages-from-w...
2016/02/21
[ "https://wordpress.stackexchange.com/questions/218390", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/80903/" ]
I was using this code: ``` add_filter( 'pre_get_posts','search_only_blog_posts' ); function search_only_blog_posts( $query ) { if ( $query->is_search ) { $query->set( 'post_type', 'post' ); } return $query; } ``` --- ..until I realized that it applies to pretty much any default search in Word...
@PieterGoosen has a good description on why your `pre_get_posts` callback is giving you a problem. Here's an alternative workaround to restrict the native *search widget* to the *post* post type: ``` /** * Restrict native search widgets to the 'post' post type */ add_filter( 'widget_title', function( $title, $inst...
218,393
<p>I'm in the process of writing a plugin and I'm trying to gauge when to use different approaches of handling errors.</p> <p>There are three methods I'm considering:</p> <ul> <li>Throwing an Exception (custom class)</li> <li>Returning an Error Object (extension of WP_Error)</li> <li>Just return null/false</li> </ul>...
[ { "answer_id": 230467, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 3, "selected": false, "text": "<p>I think it's impossible to give a definitive answer here, because choices like this are personal preference.<...
2016/02/21
[ "https://wordpress.stackexchange.com/questions/218393", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/87983/" ]
I'm in the process of writing a plugin and I'm trying to gauge when to use different approaches of handling errors. There are three methods I'm considering: * Throwing an Exception (custom class) * Returning an Error Object (extension of WP\_Error) * Just return null/false Some situations that I'm considering * Try...
I think it's impossible to give a definitive answer here, because choices like this are personal preference. Consider that what follows is *my* approach, and I have no presumption it is *the right* one. What I can say for sure is that you should avoid your third option: > > Just return null/false > > > This is ...
218,400
<p>I am using the <a href="http://themeforest.net/item/avada-responsive-multipurpose-theme/2833226" rel="nofollow noreferrer">Avada Theme</a> from Themeforest and I have set up 2 menus under <em>Appearances > Menu</em>: </p> <ul> <li><code>menu-logged-in</code> which contains a parent item (My Account) and then severa...
[ { "answer_id": 230467, "author": "gmazzap", "author_id": 35541, "author_profile": "https://wordpress.stackexchange.com/users/35541", "pm_score": 3, "selected": false, "text": "<p>I think it's impossible to give a definitive answer here, because choices like this are personal preference.<...
2016/02/21
[ "https://wordpress.stackexchange.com/questions/218400", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/63160/" ]
I am using the [Avada Theme](http://themeforest.net/item/avada-responsive-multipurpose-theme/2833226) from Themeforest and I have set up 2 menus under *Appearances > Menu*: * `menu-logged-in` which contains a parent item (My Account) and then several child items; and * `menu-logged-out` which contains a single link t...
I think it's impossible to give a definitive answer here, because choices like this are personal preference. Consider that what follows is *my* approach, and I have no presumption it is *the right* one. What I can say for sure is that you should avoid your third option: > > Just return null/false > > > This is ...
218,452
<p>I want to enqueue stylesheet to plugin I'm developing, like this:</p> <pre><code>function utm_user_scripts() { $plugin_url = plugin_dir_url( __FILE__ ); wp_enqueue_style( 'style', $plugin_url . "/css/style.css"); } add_action( 'wp_enqueue_scripts', 'utm_user_scripts' ); </code></pre> <p>I am adding this c...
[ { "answer_id": 218459, "author": "Stephen", "author_id": 85776, "author_profile": "https://wordpress.stackexchange.com/users/85776", "pm_score": 2, "selected": false, "text": "<p>I did a quick <a href=\"https://www.google.co.uk/webhp?sourceid=chrome-instant&amp;ion=1&amp;espv=2&amp;ie=UT...
2016/02/22
[ "https://wordpress.stackexchange.com/questions/218452", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84741/" ]
I want to enqueue stylesheet to plugin I'm developing, like this: ``` function utm_user_scripts() { $plugin_url = plugin_dir_url( __FILE__ ); wp_enqueue_style( 'style', $plugin_url . "/css/style.css"); } add_action( 'wp_enqueue_scripts', 'utm_user_scripts' ); ``` I am adding this code in the main file, [plu...
Add this code in your main file: [plugin-name].php: ``` function utm_user_scripts() { $plugin_url = plugin_dir_url( __FILE__ ); wp_enqueue_style( 'style', $plugin_url . "/css/style.css"); } add_action( 'admin_print_styles', 'utm_user_scripts' ); ``` So basically, you need to use 'a...
218,474
<p>If you enter <code>:)</code> in WordPress, it automatically replaces it with: </p> <p><a href="https://i.stack.imgur.com/tIOiv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tIOiv.png" alt="enter image description here"></a></p> <p>Is there a way to use a different smiley for the <code>:)</code...
[ { "answer_id": 218485, "author": "rob_st", "author_id": 29055, "author_profile": "https://wordpress.stackexchange.com/users/29055", "pm_score": 2, "selected": false, "text": "<p>According to the <a href=\"https://codex.wordpress.org/Using_Smilies\" rel=\"nofollow\">WordPress Codex on usi...
2016/02/22
[ "https://wordpress.stackexchange.com/questions/218474", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89209/" ]
If you enter `:)` in WordPress, it automatically replaces it with: [![enter image description here](https://i.stack.imgur.com/tIOiv.png)](https://i.stack.imgur.com/tIOiv.png) Is there a way to use a different smiley for the `:)`
Overriding the emoji of :) to ----------------------------- The content smilies are converted with: ``` add_filter( 'the_content', 'convert_smilies' ); ``` where [this part](https://github.com/WordPress/WordPress/blob/ae2657dd32a273a5746354629252bb00c5df689f/wp-includes/formatting.php#L2445) of the `convert_smilies...
218,488
<p>I have the following code. I have a left div and a right div. How would I edit the below code to pull the first X CPT data and put it in the right column, and the next XX number CPT data to put in the left column? Right now I am just printing same query in the two columns. Any help would be greatly appreciated.</p> ...
[ { "answer_id": 218495, "author": "MartinJJ", "author_id": 3710, "author_profile": "https://wordpress.stackexchange.com/users/3710", "pm_score": 0, "selected": false, "text": "<p><a href=\"https://codex.wordpress.org/WordPress_Backups\" rel=\"nofollow\">WP Codex</a> is your friend on this...
2016/02/22
[ "https://wordpress.stackexchange.com/questions/218488", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1354/" ]
I have the following code. I have a left div and a right div. How would I edit the below code to pull the first X CPT data and put it in the right column, and the next XX number CPT data to put in the left column? Right now I am just printing same query in the two columns. Any help would be greatly appreciated. ``` <d...
This is the reason I always recommend to use the least amount of plugins. This obviously easier to say then do, but if you are a developer you should strive to eliminate all plugins by incorporating the relevant code into a site specific plugin or theme. Integrators obviously have less ability to achieve this. The pro...
218,610
<p>I've created a child theme and the main style.css works perfectly fine. However, the parent theme has another stylesheet which I want to import and create the same for child theme and use it instead.</p> <blockquote> <p>Parent theme structure - ./woocommerce/woo.css <br> Child theme structure - ./woocommerce/wo...
[ { "answer_id": 218616, "author": "goalsquid", "author_id": 67191, "author_profile": "https://wordpress.stackexchange.com/users/67191", "pm_score": 3, "selected": false, "text": "<p>Perhaps you can try adding a priority value to each add_action to make sure that one executes before the ot...
2016/02/23
[ "https://wordpress.stackexchange.com/questions/218610", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33650/" ]
I've created a child theme and the main style.css works perfectly fine. However, the parent theme has another stylesheet which I want to import and create the same for child theme and use it instead. > > Parent theme structure - ./woocommerce/woo.css > > Child theme structure - ./woocommerce/woo.css (Manually cr...
Your child theme's `stylesheet` will usually be loaded automatically. If it is not, you will need to `enqueue` it as well. Setting 'parent-style' as a dependency will ensure that the child theme `stylesheet` loads after it. ``` /** * Enqueue theme styles (parent first, child second) * */ function wpse218610_theme_...
218,634
<p>I am having difficulty overriding the title set in the admin panel for a custom template page, and outputting a custom <code>&lt;title&gt;</code> tag.</p> <p>The parent theme is WordPress's stock Twentysixteen, which uses the <a href="https://codex.wordpress.org/Title_Tag" rel="nofollow">title-tag theme feature</a>...
[ { "answer_id": 237616, "author": "Andrew T", "author_id": 13977, "author_profile": "https://wordpress.stackexchange.com/users/13977", "pm_score": 1, "selected": false, "text": "<p>We have found this for shortcode support in titles (both header and post title):</p>\n\n<pre><code>//shortco...
2016/02/23
[ "https://wordpress.stackexchange.com/questions/218634", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31403/" ]
I am having difficulty overriding the title set in the admin panel for a custom template page, and outputting a custom `<title>` tag. The parent theme is WordPress's stock Twentysixteen, which uses the [title-tag theme feature](https://codex.wordpress.org/Title_Tag) (as opposed to the soon-to-be deprecated function wp...
If anyone else is having problems with this, it may be due to the Yoast plugin. Use: ``` add_filter( 'pre_get_document_title', function( $title ){ // Make any changes here return $title; }, 999, 1 ); ```
218,641
<p>Here is a snippet of my code</p> <pre><code> &lt;?php echo apply_filters( 'woocommerce_order_button_html', '&lt;input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" /&gt;' ...
[ { "answer_id": 218644, "author": "Tom Kentell", "author_id": 88813, "author_profile": "https://wordpress.stackexchange.com/users/88813", "pm_score": 0, "selected": false, "text": "<p>Are you targeting the right class there? Not sure if that's just example code. But I can't see that class...
2016/02/23
[ "https://wordpress.stackexchange.com/questions/218641", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89127/" ]
Here is a snippet of my code ``` <?php echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' ); ?> <?php if ...
Fixed the issue. Was calling the incorrect IDs. Below is the code I used for anybody else wanting to achieve the same outcome. ``` <script type="text/javascript" charset="utf-8"> jQuery(document).ready(function($){ $(".button#place_order").click(function () { $(".button#place_order").attr("disabled", true);...
218,689
<p>On a website made with a purchased template, a custom post-type had an archive page. I didn't want that archive page, so I altered the custom post-type in a child-theme like so:</p> <pre><code>function remove_archive(){ $portfolio = get_post_type_object( 'portfolio' ); $portfolio-&gt;has_archive = FALSE; ...
[ { "answer_id": 218821, "author": "Piyush Dhanotiya", "author_id": 74324, "author_profile": "https://wordpress.stackexchange.com/users/74324", "pm_score": 0, "selected": false, "text": "<p>The archive page is created according to the name of slug of post type so if you want to portfolio a...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218689", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/34027/" ]
On a website made with a purchased template, a custom post-type had an archive page. I didn't want that archive page, so I altered the custom post-type in a child-theme like so: ``` function remove_archive(){ $portfolio = get_post_type_object( 'portfolio' ); $portfolio->has_archive = FALSE; register_post_t...
If you are using WordPress 4.4+ (*which you should*), you can make use of the [`register_post_type_args`](https://developer.wordpress.org/reference/hooks/register_post_type_args/) filter to adjust the arguments passed to [`register_post_type()`](https://developer.wordpress.org/reference/functions/register_post_type/) w...
218,709
<p>Based on example here <a href="https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/" rel="noreferrer">https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/</a></p> <p>I'd like to modify the query</p> <pre><code>$q = new WP_Query( ...
[ { "answer_id": 218718, "author": "fischi", "author_id": 15680, "author_profile": "https://wordpress.stackexchange.com/users/15680", "pm_score": 1, "selected": false, "text": "<p>This would be done like this:</p>\n\n<pre><code>$q = new WP_Query( array(\n 'meta_query' =&gt; array(\n ...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218709", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88291/" ]
Based on example here <https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/> I'd like to modify the query ``` $q = new WP_Query( array( 'meta_query' => array( 'relation' => 'AND', 'state_clause' => array( 'key' => 'state', 'value' => 'Wisconsin', ...
You can create groups of meta\_queries using specific compare operation on them, and since you want to order based in a single custom field, you can keep the order declaration dedicated to the single meta field. So: ``` $q = new WP_Query( array( 'meta_key' => 'population', //setting the meta_key which wil...
218,713
<p>I'm trying to test if my plugin activates properly with PHPUnit. I have used boilerplate structure generated on this <a href="http://wppb.me/" rel="nofollow">site</a> and added this test:</p> <pre><code>class PluginTest extends WP_UnitTestCase { function test_plugin_activation() { include_once( ABSPATH ....
[ { "answer_id": 218730, "author": "J.D.", "author_id": 27757, "author_profile": "https://wordpress.stackexchange.com/users/27757", "pm_score": 0, "selected": false, "text": "<p>Testing plugin activation/installation and uninstall with the core WordPress test suite can be done more easily ...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218713", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/21181/" ]
I'm trying to test if my plugin activates properly with PHPUnit. I have used boilerplate structure generated on this [site](http://wppb.me/) and added this test: ``` class PluginTest extends WP_UnitTestCase { function test_plugin_activation() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); $...
Actually you cannot activate your plugin using `WP_UnitTestCase`, because in the `bootstrap.php` you've already loaded your plugin as a `mu-plugin`. What I can suggest you to test your plugin activation is: call the `do_action('activate_' . FULL_ABSPATH_TO_YOUR_PLUGIN_PHP)`, where `FULL_ABSPATH_TO_YOUR_PLUGIN_PHP` wil...
218,719
<p>I added some function code to the functions.php file of my child theme that has now set my entire site blank.</p> <p>Is the only way to get it back via cPanel and changing the theme back to the parent them in PHPMyAdmin under wp-options? (The entire is site is blank on both frontend and admin)</p>
[ { "answer_id": 218730, "author": "J.D.", "author_id": 27757, "author_profile": "https://wordpress.stackexchange.com/users/27757", "pm_score": 0, "selected": false, "text": "<p>Testing plugin activation/installation and uninstall with the core WordPress test suite can be done more easily ...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218719", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88959/" ]
I added some function code to the functions.php file of my child theme that has now set my entire site blank. Is the only way to get it back via cPanel and changing the theme back to the parent them in PHPMyAdmin under wp-options? (The entire is site is blank on both frontend and admin)
Actually you cannot activate your plugin using `WP_UnitTestCase`, because in the `bootstrap.php` you've already loaded your plugin as a `mu-plugin`. What I can suggest you to test your plugin activation is: call the `do_action('activate_' . FULL_ABSPATH_TO_YOUR_PLUGIN_PHP)`, where `FULL_ABSPATH_TO_YOUR_PLUGIN_PHP` wil...
218,731
<p>Trying to check if <code>$link</code> has <code>http://</code> in front of it or not. If someone puts in <code>www.google.com</code> for the link field it acts as a link within the WordPress site, ie: <code>www.website.com/www.google.com</code>.</p> <pre><code>$link = get_field('advertisement_link'); $ad_code = '&...
[ { "answer_id": 218734, "author": "fischi", "author_id": 15680, "author_profile": "https://wordpress.stackexchange.com/users/15680", "pm_score": 3, "selected": true, "text": "<p>You must not <code>return</code> the value, but alter the varialbe <code>$link</code></p>\n\n<pre><code>if(strp...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218731", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88720/" ]
Trying to check if `$link` has `http://` in front of it or not. If someone puts in `www.google.com` for the link field it acts as a link within the WordPress site, ie: `www.website.com/www.google.com`. ``` $link = get_field('advertisement_link'); $ad_code = '<a href="'.$link.'" target="_blank">Test</a>'; ``` Sample...
You must not `return` the value, but alter the varialbe `$link` ``` if(strpos($link, 'http://') !== 0) { $link = 'http://' . $link; } //no else needed ``` Be aware that if your link begins with `https://` it will also prepend the `http://` and result in `http://https://example.com`. The better way to do this wo...
218,746
<p>I have a function, within <code>functions.php</code> (all code below), that adds an advertisement after <code>x</code> amount of paragraphs to any given <code>single.php</code> post. I have a custom-post-type called <code>advertising</code> that has a Title, Image, and URL field for the advertisement post. In any <c...
[ { "answer_id": 218747, "author": "Sumit", "author_id": 32475, "author_profile": "https://wordpress.stackexchange.com/users/32475", "pm_score": 2, "selected": false, "text": "<p>First get the random advertising post by <code>get_posts</code></p>\n\n<pre><code>$random_ad = get_posts(array(...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218746", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88720/" ]
I have a function, within `functions.php` (all code below), that adds an advertisement after `x` amount of paragraphs to any given `single.php` post. I have a custom-post-type called `advertising` that has a Title, Image, and URL field for the advertisement post. In any `single.php` post I have a checkbox to show the a...
As already pointed out, random ordering and searching is quite expensive operations to run, so lets look at how we are going to sort that issue. Because you only need one post from your custom post type, we only need one random ID which we can pass to `get_post()` in order to get the desired post. Instead of getting t...
218,750
<p>In my <code>functions.php</code> I have:</p> <pre><code> global $wpdb; $wpdb-&gt;update( $wpdb-&gt;posts, array('post_content' =&gt; $newcontent), array('ID' =&gt; $post_id) ); </code></pre> <p>this code updates the <code>post_content</code> in the WP DB with my <code>$newcontent</code> when I publi...
[ { "answer_id": 218747, "author": "Sumit", "author_id": 32475, "author_profile": "https://wordpress.stackexchange.com/users/32475", "pm_score": 2, "selected": false, "text": "<p>First get the random advertising post by <code>get_posts</code></p>\n\n<pre><code>$random_ad = get_posts(array(...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218750", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89045/" ]
In my `functions.php` I have: ``` global $wpdb; $wpdb->update( $wpdb->posts, array('post_content' => $newcontent), array('ID' => $post_id) ); ``` this code updates the `post_content` in the WP DB with my `$newcontent` when I publish a post. In fact I can see the modified content inside the DB and of ...
As already pointed out, random ordering and searching is quite expensive operations to run, so lets look at how we are going to sort that issue. Because you only need one post from your custom post type, we only need one random ID which we can pass to `get_post()` in order to get the desired post. Instead of getting t...
218,756
<p>I am using Simple Urls to setup redirects on my blog. I am trying to create redirects automatically upon publishing a post. For example, If i publish a post about StudioPress it will be automatically publish a redirect with Title similar to blog post. i.e StudioPress. and the "URL" custom field will update the Redir...
[ { "answer_id": 218747, "author": "Sumit", "author_id": 32475, "author_profile": "https://wordpress.stackexchange.com/users/32475", "pm_score": 2, "selected": false, "text": "<p>First get the random advertising post by <code>get_posts</code></p>\n\n<pre><code>$random_ad = get_posts(array(...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218756", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/75462/" ]
I am using Simple Urls to setup redirects on my blog. I am trying to create redirects automatically upon publishing a post. For example, If i publish a post about StudioPress it will be automatically publish a redirect with Title similar to blog post. i.e StudioPress. and the "URL" custom field will update the Redirect...
As already pointed out, random ordering and searching is quite expensive operations to run, so lets look at how we are going to sort that issue. Because you only need one post from your custom post type, we only need one random ID which we can pass to `get_post()` in order to get the desired post. Instead of getting t...
218,765
<p>I have been working on open source plugin and trying to add a new feature to it. For now I have been doing like this</p> <pre><code>else if( $selected_report == "greport" ) { $sql = mysql_query( "SELECT rating_postid FROM {$wpdb-&gt;ratings}" ) or die( mysql_error() ); } generate_csv( $sql ); exit; function ...
[ { "answer_id": 218781, "author": "Mridul Aggarwal", "author_id": 22495, "author_profile": "https://wordpress.stackexchange.com/users/22495", "pm_score": 0, "selected": false, "text": "<p>You should never use any mysql functions in wordpress. When you call wordpress functions, you will ge...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218765", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/88932/" ]
I have been working on open source plugin and trying to add a new feature to it. For now I have been doing like this ``` else if( $selected_report == "greport" ) { $sql = mysql_query( "SELECT rating_postid FROM {$wpdb->ratings}" ) or die( mysql_error() ); } generate_csv( $sql ); exit; function generate_csv( $sq...
By default `$wpdb->get_results()` returns results in the form of an array of objects. If you want an array of associative arrays instead, just do this: ``` $results = $wpdb->get_results( "...", ARRAY_A ); ``` Obviously I'm not familiar with your project or the code you're using, and I haven't tested this, but you'd ...
218,784
<p>I am building a plugin that uses Stripe for the payment processing. I have included Stripe's PHP library into my plugin and everything works great. But what if someone else makes a plugin that also uses Stripe ... or worse, an older version of Stripe that isn't compatible with mine? Sounds like there could be confli...
[ { "answer_id": 219064, "author": "Tony DeStefano", "author_id": 84214, "author_profile": "https://wordpress.stackexchange.com/users/84214", "pm_score": 2, "selected": false, "text": "<p>I went ahead and namespaced Stripe. Everything worked just great. And now I don't have to worry about ...
2016/02/24
[ "https://wordpress.stackexchange.com/questions/218784", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84214/" ]
I am building a plugin that uses Stripe for the payment processing. I have included Stripe's PHP library into my plugin and everything works great. But what if someone else makes a plugin that also uses Stripe ... or worse, an older version of Stripe that isn't compatible with mine? Sounds like there could be conflicts...
I went ahead and namespaced Stripe. Everything worked just great. And now I don't have to worry about any one else's Stripe library messing up my stuff. Original: ``` namespace Stripe; ``` New: ``` namespace MyRadNamespace\Stripe; ``` If anyone is interested in seeing how it's done, feel free to browse my repo: ...
218,825
<p>I have a warning via WordPress Themecheck plugin WARNING : Found a translation function that is missing a text-domain. Function esc_html__, with the arguments</p> <p>As you can see, there is no arguments listed above and I'm really lost on this.</p> <p>Here's the code function:</p> <pre><code>&lt;?php wp_n...
[ { "answer_id": 219064, "author": "Tony DeStefano", "author_id": 84214, "author_profile": "https://wordpress.stackexchange.com/users/84214", "pm_score": 2, "selected": false, "text": "<p>I went ahead and namespaced Stripe. Everything worked just great. And now I don't have to worry about ...
2016/02/25
[ "https://wordpress.stackexchange.com/questions/218825", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33903/" ]
I have a warning via WordPress Themecheck plugin WARNING : Found a translation function that is missing a text-domain. Function esc\_html\_\_, with the arguments As you can see, there is no arguments listed above and I'm really lost on this. Here's the code function: ``` <?php wp_nonce_field( basename( __FILE...
I went ahead and namespaced Stripe. Everything worked just great. And now I don't have to worry about any one else's Stripe library messing up my stuff. Original: ``` namespace Stripe; ``` New: ``` namespace MyRadNamespace\Stripe; ``` If anyone is interested in seeing how it's done, feel free to browse my repo: ...
218,827
<p>I have a post with text then "the more" then text after that.</p> <p>The teaser before the more displays on the archive page, but I don't want to display it on my single post page, only the text after the more should appear.</p> <p>How do I do this? </p> <p>i.e</p> <p>This is my text before the more don't show i...
[ { "answer_id": 218834, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 3, "selected": true, "text": "<p>You probably looking at something like <a href=\"https://codex.wordpress.org/Function_Reference/get_exte...
2016/02/25
[ "https://wordpress.stackexchange.com/questions/218827", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/69240/" ]
I have a post with text then "the more" then text after that. The teaser before the more displays on the archive page, but I don't want to display it on my single post page, only the text after the more should appear. How do I do this? i.e This is my text before the more don't show it. --The More-- Text after th...
You probably looking at something like [`get_extended()`](https://codex.wordpress.org/Function_Reference/get_extended). It returns the content in an array with the following key=>value pairs * `main` => The content before the more tag * `extended` => The content after the more tag * `more_text` => The custom read more...
218,843
<p>I have created a custom theme. Now I want to add WooCommerce to that theme but it doesn't work like the way it should.</p> <p>After install of the WooCommerce plugin I followed all provided steps.<br>All pages needed are created and I have added my first product.</p> <p>In the admin panel I get the message:</p> <...
[ { "answer_id": 218846, "author": "Interactive", "author_id": 52240, "author_profile": "https://wordpress.stackexchange.com/users/52240", "pm_score": 1, "selected": false, "text": "<p>Oke found it....</p>\n\n<p>You (I) have to update the permalinks settings.</p>\n\n<p>There is a shoppart ...
2016/02/25
[ "https://wordpress.stackexchange.com/questions/218843", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/52240/" ]
I have created a custom theme. Now I want to add WooCommerce to that theme but it doesn't work like the way it should. After install of the WooCommerce plugin I followed all provided steps. All pages needed are created and I have added my first product. In the admin panel I get the message: > > Your theme does no...
Oke found it.... You (I) have to update the permalinks settings. There is a shoppart added to the default page. select the custom part and add the name of your shop page starting with a `/` e.g. `/shop`
218,877
<p>In a custom post type I have set <code>has_archive</code> to <code>false</code>. In the head of a CPT page however I still find a link to a feed like this: </p> <pre><code>&lt;link … title="Page Title | Comments Feed" href="domain/cpt/slug/feed/" /&gt; </code></pre> <p>The feed doesn't exist – the link generates a...
[ { "answer_id": 235052, "author": "user2100505", "author_id": 100490, "author_profile": "https://wordpress.stackexchange.com/users/100490", "pm_score": 3, "selected": true, "text": "<p>Following command hides comments feed for posts (WP 4.4+ required!), but custom pages still have comment...
2016/02/25
[ "https://wordpress.stackexchange.com/questions/218877", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/26059/" ]
In a custom post type I have set `has_archive` to `false`. In the head of a CPT page however I still find a link to a feed like this: ``` <link … title="Page Title | Comments Feed" href="domain/cpt/slug/feed/" /> ``` The feed doesn't exist – the link generates a 404 error. I tried to remove the link with the filter...
Following command hides comments feed for posts (WP 4.4+ required!), but custom pages still have comments feed displayed, even if comments are disabled for such page: ``` add_filter( 'feed_links_show_comments_feed', '__return_false' ); ``` To resolve this, I had to add this addidtional code too: ``` function remove...
218,885
<p>I am building a plugin. I have to output certain stuff in the header.php file of the theme depending on if/else I will write. However I am not at that point yet. I just learned in order to push the function into header.php I have to use <code>wp_head</code>. Unfortuatenly when I do this I get a lot of extra stuff pr...
[ { "answer_id": 218891, "author": "Bryan Willis", "author_id": 38123, "author_profile": "https://wordpress.stackexchange.com/users/38123", "pm_score": 3, "selected": true, "text": "<p>Removing wp_head will have some negative effects as it won't allow you to use virtually 90% of the plugin...
2016/02/25
[ "https://wordpress.stackexchange.com/questions/218885", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1354/" ]
I am building a plugin. I have to output certain stuff in the header.php file of the theme depending on if/else I will write. However I am not at that point yet. I just learned in order to push the function into header.php I have to use `wp_head`. Unfortuatenly when I do this I get a lot of extra stuff processed by Wor...
Removing wp\_head will have some negative effects as it won't allow you to use virtually 90% of the plugins on wordpress.org. Also some of that code you are seeing only shows up when you are logged in (unless your theme is specifically adding it). For example, the dashicons, open sans, and admin-bar stylesheets and inl...
218,896
<p>We discover that our Single Product images as set in Woocommerce> Setting > Products > Display are set to big. Single Product Image: 500 ×750px xHard Crop</p> <p>I have tested plugin regenerate thumbnails but that does not work on the product images. Also test plugins Resize-image-after-upload. But that plugin does...
[ { "answer_id": 218891, "author": "Bryan Willis", "author_id": 38123, "author_profile": "https://wordpress.stackexchange.com/users/38123", "pm_score": 3, "selected": true, "text": "<p>Removing wp_head will have some negative effects as it won't allow you to use virtually 90% of the plugin...
2016/02/25
[ "https://wordpress.stackexchange.com/questions/218896", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78746/" ]
We discover that our Single Product images as set in Woocommerce> Setting > Products > Display are set to big. Single Product Image: 500 ×750px xHard Crop I have tested plugin regenerate thumbnails but that does not work on the product images. Also test plugins Resize-image-after-upload. But that plugin does it for al...
Removing wp\_head will have some negative effects as it won't allow you to use virtually 90% of the plugins on wordpress.org. Also some of that code you are seeing only shows up when you are logged in (unless your theme is specifically adding it). For example, the dashicons, open sans, and admin-bar stylesheets and inl...
218,911
<p>I have post type <code>example</code> with 2 records: <code>exam1</code> and <code>exam2</code>. This post type was created by plugin <code>Types Toolset</code> (<code>www.wp-types.com</code>). So link to <code>exam1</code> looks like <code>my_site/example/exam1</code>. Also I have 1 GET-parameter: <code>my_site/exa...
[ { "answer_id": 218923, "author": "bosco", "author_id": 25324, "author_profile": "https://wordpress.stackexchange.com/users/25324", "pm_score": 1, "selected": false, "text": "<h2>Terminology</h2>\n<p>I think you have some terminology a little mixed up:</p>\n<ul>\n<li>A URL &quot;rewrite&q...
2016/02/25
[ "https://wordpress.stackexchange.com/questions/218911", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89492/" ]
I have post type `example` with 2 records: `exam1` and `exam2`. This post type was created by plugin `Types Toolset` (`www.wp-types.com`). So link to `exam1` looks like `my_site/example/exam1`. Also I have 1 GET-parameter: `my_site/example/exam1?get=param`. What I need. I need to rewrite URL from `my_site/example/ex...
Terminology ----------- I think you have some terminology a little mixed up: * A URL "rewrite" alters the endpoint of a HTTP request. If `http://example.com/param/exam1` really serves content from `http://example.com/examples/exam1?get=param`, then the former is being rewritten to the latter (though not necessarily v...
218,926
<p>I have this custom function that get's the manually entered excerpt and trims it down but the problem I'm having is that it is trimming the characters down to 52 and instead I want it to return the first 52 Words like the normal excerpt.</p> <p>Here's the custom that allows me to trim the manually entered excerpt</...
[ { "answer_id": 218929, "author": "jgraup", "author_id": 84219, "author_profile": "https://wordpress.stackexchange.com/users/84219", "pm_score": 0, "selected": false, "text": "<p><a href=\"http://php.net/manual/en/function.explode.php\" rel=\"nofollow\">explode</a>, <a href=\"http://php.n...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/218926", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/85776/" ]
I have this custom function that get's the manually entered excerpt and trims it down but the problem I'm having is that it is trimming the characters down to 52 and instead I want it to return the first 52 Words like the normal excerpt. Here's the custom that allows me to trim the manually entered excerpt ``` functi...
The function you want is [**`wp_trim_words()`**](https://codex.wordpress.org/Function_Reference/wp_trim_words), example: ``` function themeTemplate_trim_excerpt( $content ) { $more = '...'; //where $more is optional return wp_trim_words($content, 52, $more); } remove_filter('get_the_excerpt', 'wp_trim_excerpt...
218,954
<p>I submit a WordPress theme for Themeforest and one of the reasons for rejection was as follows:</p> <blockquote> <p>Globals should always be within a function or a class and should be used restrictively &amp; only if theme really needs to. It's highly recommended not to use them at all just to keep things out of ...
[ { "answer_id": 218955, "author": "Pieter Goosen", "author_id": 31545, "author_profile": "https://wordpress.stackexchange.com/users/31545", "pm_score": 2, "selected": false, "text": "<p>First, I must congratulate the reply from Themeforest, that really deserves a beer. Globals are evil an...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/218954", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33903/" ]
I submit a WordPress theme for Themeforest and one of the reasons for rejection was as follows: > > Globals should always be within a function or a class and should be used restrictively & only if theme really needs to. It's highly recommended not to use them at all just to keep things out of the global namespace, th...
If you're dealing with framework that holds values in a global variable then there isn't much you can do about it. Here is an example of wrapping the variable in a static getter. ``` if ( ! class_exists( 'SMOFData' ) ): class SMOFData { static public function is( $key, $compare ) { $value = s...
218,959
<p>I have multiple forms(contact form 7) in a page and need to reset the recaptcha after the form is submitted via ajax. I checked recaptcha API and it has <code>grecaptcha.reset();</code> but it resets only first recaptcha in a page.</p> <p>Following is the method to target a specific recaptcha according to recaptcha...
[ { "answer_id": 219732, "author": "roshan", "author_id": 82786, "author_profile": "https://wordpress.stackexchange.com/users/82786", "pm_score": 2, "selected": false, "text": "<p>Since the recaptcha is created by contact form 7 without assigning the rendered recaptcha to a variable it was...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/218959", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/82786/" ]
I have multiple forms(contact form 7) in a page and need to reset the recaptcha after the form is submitted via ajax. I checked recaptcha API and it has `grecaptcha.reset();` but it resets only first recaptcha in a page. Following is the method to target a specific recaptcha according to recaptcha API: ``` grecaptcha...
Since the recaptcha is created by contact form 7 without assigning the rendered recaptcha to a variable it was not possible to use grecaptcha.reset(opt\_widget\_id). Here is what is did: ``` $(".wpcf7-submit").click(function(event) { var currentForm=$(this).closest("form"); $( document ).ajaxComplete(function(event,re...
218,978
<p>I'm just starting out on a new Wordpress project and for some reason I can't get the previews working. I have disabled all of my plugins and still i always get false when using <code>is_preview()</code>.</p> <p>Currently I'm just creating a page that renders via page.php where I only call <code>var_dump(is_preview(...
[ { "answer_id": 219732, "author": "roshan", "author_id": 82786, "author_profile": "https://wordpress.stackexchange.com/users/82786", "pm_score": 2, "selected": false, "text": "<p>Since the recaptcha is created by contact form 7 without assigning the rendered recaptcha to a variable it was...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/218978", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64223/" ]
I'm just starting out on a new Wordpress project and for some reason I can't get the previews working. I have disabled all of my plugins and still i always get false when using `is_preview()`. Currently I'm just creating a page that renders via page.php where I only call `var_dump(is_preview())` and it always shows fa...
Since the recaptcha is created by contact form 7 without assigning the rendered recaptcha to a variable it was not possible to use grecaptcha.reset(opt\_widget\_id). Here is what is did: ``` $(".wpcf7-submit").click(function(event) { var currentForm=$(this).closest("form"); $( document ).ajaxComplete(function(event,re...
218,980
<p>My theme has support for title-tag <code>add_theme_support('title-tag')</code>, but I can't remove the wordpress description <code>bloginfo('description')</code> from <code>&lt;title&gt;</code> on Home page.</p> <p>I'm trying using this filter with no success:</p> <pre><code>add_filter( 'wp_title', function ( $tit...
[ { "answer_id": 218982, "author": "fischi", "author_id": 15680, "author_profile": "https://wordpress.stackexchange.com/users/15680", "pm_score": 1, "selected": false, "text": "<p>The problem is the line:</p>\n\n<pre><code>$title = \"$title\";\n</code></pre>\n\n<p>You actually just change ...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/218980", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38553/" ]
My theme has support for title-tag `add_theme_support('title-tag')`, but I can't remove the wordpress description `bloginfo('description')` from `<title>` on Home page. I'm trying using this filter with no success: ``` add_filter( 'wp_title', function ( $title, $sep ) { global $paged, $page; $title .= get_bl...
Found a solution: ``` add_filter( 'pre_get_document_title', function ( $title ) { if(is_front_page()){ $title = get_bloginfo(); } return $title; }); ```
218,993
<p>I have a custom post <code>estate_property</code> and its has taxonomies <code>property_category</code> ,<code>propert_action</code>.I have installed <code>WPCustom Category Image</code> to upload image for each category of taxonomies. How to display the uploaded image .I search for it but failed to display image ...
[ { "answer_id": 219009, "author": "Jorin van Vilsteren", "author_id": 68062, "author_profile": "https://wordpress.stackexchange.com/users/68062", "pm_score": 0, "selected": false, "text": "<p>I'm not familiar with the WPCustom Category Image plugin, but it probably need another function s...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/218993", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84928/" ]
I have a custom post `estate_property` and its has taxonomies `property_category` ,`propert_action`.I have installed `WPCustom Category Image` to upload image for each category of taxonomies. How to display the uploaded image .I search for it but failed to display image My code is ``` $taxonomy_name = 'property_cate...
From the details page of the WPCustom Category Image Plug-in : <https://wordpress.org/support/plugin/wpcustom-category-image> **1st** - Go to Wp-Admin -> Posts(or post type) -> Categories (or taxonomy) to see Custom Category Image options. **2nd** ...depending on whether you want to show a single category image or di...
219,011
<p>So I have a dropdown menu that has a list of all pages using a certain template, when the user selects a dropdown item id like them to be re-directed to that page. </p> <p>Here is what I have so far... </p> <pre><code> &lt;div class="col-md-6 col-md-offset-3"&gt; &lt;?php ...
[ { "answer_id": 219009, "author": "Jorin van Vilsteren", "author_id": 68062, "author_profile": "https://wordpress.stackexchange.com/users/68062", "pm_score": 0, "selected": false, "text": "<p>I'm not familiar with the WPCustom Category Image plugin, but it probably need another function s...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/219011", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/85362/" ]
So I have a dropdown menu that has a list of all pages using a certain template, when the user selects a dropdown item id like them to be re-directed to that page. Here is what I have so far... ``` <div class="col-md-6 col-md-offset-3"> <?php //create a var using get_page...
From the details page of the WPCustom Category Image Plug-in : <https://wordpress.org/support/plugin/wpcustom-category-image> **1st** - Go to Wp-Admin -> Posts(or post type) -> Categories (or taxonomy) to see Custom Category Image options. **2nd** ...depending on whether you want to show a single category image or di...
219,033
<p>I want to do the following in a plugin: - hook to <code>untrash_post</code>with a custom function - do some checking inside custom function - cancel actual post restoring (untrashing)</p> <p>I've tried with <code>remove_action</code> but doesn't seem to work. Can you point me into the right direction?</p> <p>Code...
[ { "answer_id": 219009, "author": "Jorin van Vilsteren", "author_id": 68062, "author_profile": "https://wordpress.stackexchange.com/users/68062", "pm_score": 0, "selected": false, "text": "<p>I'm not familiar with the WPCustom Category Image plugin, but it probably need another function s...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/219033", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71228/" ]
I want to do the following in a plugin: - hook to `untrash_post`with a custom function - do some checking inside custom function - cancel actual post restoring (untrashing) I've tried with `remove_action` but doesn't seem to work. Can you point me into the right direction? Code sample: ``` add_action( 'untrash_post...
From the details page of the WPCustom Category Image Plug-in : <https://wordpress.org/support/plugin/wpcustom-category-image> **1st** - Go to Wp-Admin -> Posts(or post type) -> Categories (or taxonomy) to see Custom Category Image options. **2nd** ...depending on whether you want to show a single category image or di...
219,041
<p>I created enclosing shortcodes like this:</p> <pre><code>//[rezept] function rezept_func( $atts, $content = null ){ return '&lt;div class="drl-rezept-wrapper"&gt;'.do_shortcode($content).'&lt;/div&gt;'; } add_shortcode( 'rezept', 'rezept_func' ); function rezept_zutaten_func( $atts, $content = null ){ retu...
[ { "answer_id": 219042, "author": "Sumit", "author_id": 32475, "author_profile": "https://wordpress.stackexchange.com/users/32475", "pm_score": -1, "selected": false, "text": "<p><code>&lt;br /&gt;</code> tags coming from the content editor. You added line breaks which are converted to <c...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/219041", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/62987/" ]
I created enclosing shortcodes like this: ``` //[rezept] function rezept_func( $atts, $content = null ){ return '<div class="drl-rezept-wrapper">'.do_shortcode($content).'</div>'; } add_shortcode( 'rezept', 'rezept_func' ); function rezept_zutaten_func( $atts, $content = null ){ return '<div class="drl-rezept...
If you want to just strip the `<br />` from the content then you could modify your function to replace that signature with an empty string. It feels like a dirty hack, but it's working for me. It's worth noting that my Chrome tools show `<br>` but the actual code is rendering `<br />` which is what the expression is c...
219,049
<p>I'm developing a plugin that use a Google Maps API. The plugin enqueuing script in this way: </p> <p><code>wp_enqueue_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false&amp;callback=initialize&amp;language=en-us', array('jquery'), false, true);</code></p> <p>Considering the fact that other plug...
[ { "answer_id": 219051, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 3, "selected": false, "text": "<p>Don't stress about it. There are many ways in which plugins and themes can break each other and you just ...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/219049", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/38121/" ]
I'm developing a plugin that use a Google Maps API. The plugin enqueuing script in this way: `wp_enqueue_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false&callback=initialize&language=en-us', array('jquery'), false, true);` Considering the fact that other plugins/themes may use same maps library...
**EDIT :** use `wp_enqueue_script` as you want (enqueue in header or footer after jQuery as you want) to enqueue file called something like : `gmap.js` included in your plugin ``` wp_enqueue_script('custom-gmap', plugin_dir_url( __FILE__ ).'inc/js/gmap.js', array('jquery'), false, true);//just change your path and na...
219,062
<p>I want to display some data from an author on my loop with this code:</p> <ul> <li><p>Avatar</p> <pre><code>&lt;?php echo get_avatar( $q-&gt;ID, 255 ); ?&gt; </code></pre></li> <li><p>Name.</p> <pre><code>&lt;?php echo get_the_author_meta('display_name', $q-&gt;ID);?&gt; </code></pre></li> <li><p>Total post.</p> ...
[ { "answer_id": 219063, "author": "Ryan", "author_id": 80192, "author_profile": "https://wordpress.stackexchange.com/users/80192", "pm_score": 1, "selected": true, "text": "<p><strong>the_author_posts()</strong> doesn't accept any parameters see the following codex page for more info:</p>...
2016/02/26
[ "https://wordpress.stackexchange.com/questions/219062", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89109/" ]
I want to display some data from an author on my loop with this code: * Avatar ``` <?php echo get_avatar( $q->ID, 255 ); ?> ``` * Name. ``` <?php echo get_the_author_meta('display_name', $q->ID);?> ``` * Total post. ``` <?php echo 'Posts made: ' . count_user_posts( get_the_author_meta($q->ID) ); ?> ``` Full cod...
**the\_author\_posts()** doesn't accept any parameters see the following codex page for more info: <https://codex.wordpress.org/Function_Reference/the_author_posts#Parameters> **\* *UPDATED* \*** Someone else had posted a VERY similar question. This should solve your problem: [Show author post count in sidebar - Va...
219,072
<p>I am looking for a way to embed WordPress <code>comment form</code> to <code>watch.php</code> in order to allow user to comment on a specific video. Can you tell me how?</p> <p><a href="https://i.stack.imgur.com/KGcAR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KGcAR.jpg" alt="Eaxample"></a><...
[ { "answer_id": 219126, "author": "Jouke Nienhuis", "author_id": 86558, "author_profile": "https://wordpress.stackexchange.com/users/86558", "pm_score": 0, "selected": false, "text": "<p>If the video is embedded in a normal post, you just switch on the option leave comments below your pos...
2016/02/27
[ "https://wordpress.stackexchange.com/questions/219072", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89567/" ]
I am looking for a way to embed WordPress `comment form` to `watch.php` in order to allow user to comment on a specific video. Can you tell me how? [![Eaxample](https://i.stack.imgur.com/KGcAR.jpg)](https://i.stack.imgur.com/KGcAR.jpg)
Take a look at rendering a [`comment_form`](https://codex.wordpress.org/Function_Reference/comment_form). You can render it anywhere in your page template and there are lots of ways to customize it. ``` $comments_args = array ( // change the title of send button 'label_submit' => 'Send', // change t...
219,095
<p>When installing a fresh wordpress, one of the things one should do is, updating the salts in <code>wp-config.php</code>. </p> <p>The section looks like this</p> <pre><code>define('AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY', ...
[ { "answer_id": 219137, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": false, "text": "<ol>\n<li><p>It depends on the randomness that can be achieved on your machine. I don't remebmer the exact d...
2016/02/27
[ "https://wordpress.stackexchange.com/questions/219095", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/64782/" ]
When installing a fresh wordpress, one of the things one should do is, updating the salts in `wp-config.php`. The section looks like this ``` define('AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY', 'put your unique phrase here')...
> > 1. Is `wp_generate_password()` as safe as the salts generated by the recommended `https://api.wordpress.org/secret-key/1.1/salt/`? > > > Those details can't be answered as for obvious reasons, the internals are unknown by the public. If we could answer that, then details would be known that allow for reverse e...
219,114
<p>I am saving extra profile fields to my users' profiles - not via User admin but via another method (a plugin, but that's not important - all the user data is there properly).</p> <p>Now I do also want to show the extra info on User profiles in the admin backend, and make them editable there, too. I have followed th...
[ { "answer_id": 219137, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": false, "text": "<ol>\n<li><p>It depends on the randomness that can be achieved on your machine. I don't remebmer the exact d...
2016/02/27
[ "https://wordpress.stackexchange.com/questions/219114", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/39300/" ]
I am saving extra profile fields to my users' profiles - not via User admin but via another method (a plugin, but that's not important - all the user data is there properly). Now I do also want to show the extra info on User profiles in the admin backend, and make them editable there, too. I have followed the Justin T...
> > 1. Is `wp_generate_password()` as safe as the salts generated by the recommended `https://api.wordpress.org/secret-key/1.1/salt/`? > > > Those details can't be answered as for obvious reasons, the internals are unknown by the public. If we could answer that, then details would be known that allow for reverse e...
219,133
<p>I Know this may be the repetitive question, But whatever solutions are given, nothing is helping me..</p> <p>I have created the page </p> <pre><code>http://creditsmart.in/wp-content/themes/voice/emicalc.html </code></pre> <p>I want to add this page to my WordPress Page Only..</p> <p>1) I have tried 'text' mode u...
[ { "answer_id": 219134, "author": "Ittikorn S.", "author_id": 68069, "author_profile": "https://wordpress.stackexchange.com/users/68069", "pm_score": 1, "selected": false, "text": "<p>I tried to insert this <code>iframe</code> code into the text mode and it seems to be working. You can ad...
2016/02/28
[ "https://wordpress.stackexchange.com/questions/219133", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89624/" ]
I Know this may be the repetitive question, But whatever solutions are given, nothing is helping me.. I have created the page ``` http://creditsmart.in/wp-content/themes/voice/emicalc.html ``` I want to add this page to my WordPress Page Only.. 1) I have tried 'text' mode using iframe. Nothing happened.. 2) I ...
You can't because it's a non-secure page `http` but you're loading into an `https` page. It's called [`Mixed Content`](https://developer.mozilla.org/en-US/docs/Security/Mixed_content). --- Adjust your protocol to `//` and hope it renders over `https`. ``` <iframe src="//creditsmart.in/wp-content/themes/voice/emicalc...
219,171
<p>Im using successfully the google CDN jQuery files instead of the built in files from Wordpress with the following code in my functions.php:</p> <pre><code>function register_jquery() { if (!is_admin()) { wp_deregister_script('jquery-core'); wp_register_script('jquery-core', 'https://ajax.google...
[ { "answer_id": 219178, "author": "markratledge", "author_id": 268, "author_profile": "https://wordpress.stackexchange.com/users/268", "pm_score": 2, "selected": false, "text": "<p>One: Generally, <em>as pointed out in the comments,</em> this is a bad idea for your code, because things wi...
2016/02/28
[ "https://wordpress.stackexchange.com/questions/219171", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/45407/" ]
Im using successfully the google CDN jQuery files instead of the built in files from Wordpress with the following code in my functions.php: ``` function register_jquery() { if (!is_admin()) { wp_deregister_script('jquery-core'); wp_register_script('jquery-core', 'https://ajax.googleapis.com/ajax/l...
The Good Answer --------------- The only good answer to this question is **don't do it** - simple as that. Software in general expect things to work certain ways and libraries that are constantly evolving can have `breaking changes`. That means the change will cause another piece of software to stop working correctly...
219,222
<p>When I do this:</p> <pre><code>function append_album_review_to_title( $title ) { global $post; if ( get_post_type( $post-&gt;ID ) == 'album_review' &amp;&amp; in_the_loop() ){ return 'Album Review: ' . $title; } else { return $title; } } add_filter('the_title', 'append_album_review_t...
[ { "answer_id": 219231, "author": "Ittikorn S.", "author_id": 68069, "author_profile": "https://wordpress.stackexchange.com/users/68069", "pm_score": -1, "selected": false, "text": "<p>Try to use <code>wp_title</code> filter instead of <code>the_title</code> to rewrite on title meta tag</...
2016/02/29
[ "https://wordpress.stackexchange.com/questions/219222", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/63378/" ]
When I do this: ``` function append_album_review_to_title( $title ) { global $post; if ( get_post_type( $post->ID ) == 'album_review' && in_the_loop() ){ return 'Album Review: ' . $title; } else { return $title; } } add_filter('the_title', 'append_album_review_to_title'); ``` The titl...
### Solution ``` function append_album_review_to_title( $title, $id = NULL ) { if ($id) { if ( get_post_type( $id ) == 'album_review' ){ return 'Album Review: ' . $title; } else { return $title; } } else { return 'Album Review: ' . $title; }; } add_fi...
219,230
<p>I'm looking for a way to test out some <a href="http://wp-cli.org" rel="nofollow">WP-CLI</a> commands but from the <a href="https://wordpress.org/plugins/debug-bar-console/" rel="nofollow">Debug Bar Console</a> where I normally test <strong>PHP</strong>. For cases when I don't want to switch windows to <strong>SSH</...
[ { "answer_id": 219233, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 1, "selected": false, "text": "<p>WP-CLI is not different from any other server side utilities in that you need to be able to have the perm...
2016/02/29
[ "https://wordpress.stackexchange.com/questions/219230", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84219/" ]
I'm looking for a way to test out some [WP-CLI](http://wp-cli.org) commands but from the [Debug Bar Console](https://wordpress.org/plugins/debug-bar-console/) where I normally test **PHP**. For cases when I don't want to switch windows to **SSH**, this might be a way to reuse/develop effective **CLI** methods outside o...
It looks like [`exec()`](http://php.net/manual/en/function.system.php) might still work with the right variables. ``` $last_line = exec( $command, &$output, &$return_var ) ``` The second parameter captures all the return data while the return from the function captures the last line. --- * [`string exec( string $c...
219,277
<p>What I'm trying to achive, is to set 2 loops on one page. <strong>First one</strong> takes 11 latest posts and sort them in rand order. <strong>Second</strong> show the rest of posts ordered by date. </p> <p><strong><em>FIRST LOOP</em></strong></p> <pre><code>$args = array('posts_per_page' =&gt; 11,'orderby' =&gt;...
[ { "answer_id": 219280, "author": "fischi", "author_id": 15680, "author_profile": "https://wordpress.stackexchange.com/users/15680", "pm_score": 1, "selected": false, "text": "<p>The second query will not always show the same posts, as it is dependend on the first query, which is random.<...
2016/02/29
[ "https://wordpress.stackexchange.com/questions/219277", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89711/" ]
What I'm trying to achive, is to set 2 loops on one page. **First one** takes 11 latest posts and sort them in rand order. **Second** show the rest of posts ordered by date. ***FIRST LOOP*** ``` $args = array('posts_per_page' => 11,'orderby' => 'rand' , 'order' => 'ASC'); $loop = new WP_Query($args); $do_not_duplica...
With some clues from @PieterGoosen I've found working solution. **First loop** ``` $argsR = array( 'numberposts' => 11, 'fields' => 'ids' ); $latest_posts = get_posts( $argsR ); shuffle( $latest_posts ); $args = array('posts_per_page' => 11, 'post__in' => $latest_posts , ...