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
262,754
<p>I need to fill form fields with post_meta from an ajax response. </p> <p>Everything works properly. </p> <p>I could hard-code the swapping of each piece of data.meta into its form field. But that approach is not reusable. </p> <p>Is there a way to loop through the data.meta instead? </p> <p>In some cases, there...
[ { "answer_id": 262762, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 1, "selected": false, "text": "<p>First, I can count on one finger the number of times A code which was developed in the hope of being \"re...
2017/04/06
[ "https://wordpress.stackexchange.com/questions/262754", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/16575/" ]
I need to fill form fields with post\_meta from an ajax response. Everything works properly. I could hard-code the swapping of each piece of data.meta into its form field. But that approach is not reusable. Is there a way to loop through the data.meta instead? In some cases, there may not be meta for all the fo...
This works for me and is reusable. It assumes your form field ids match your post\_meta keys. ``` if (data.status === 'success') { // populate form with post_meta $.each(data.meta, function(key,value) { //alert(key + '---' + value[0]); var $form_element = $("#" + key); if ( $form_el...
262,759
<p>I'm using the Wordpress Plugin Boilerplate to make a plugin and I'm having some trouble outputting a form for users to input configuration options for the said plugin.</p> <p>I have the following methods for a class</p> <pre><code>public function admin_add_menu() { add_menu_page( 'Paypal Me Order',...
[ { "answer_id": 262819, "author": "MagniGeeks Technologies", "author_id": 116950, "author_profile": "https://wordpress.stackexchange.com/users/116950", "pm_score": 3, "selected": false, "text": "<p>Try this. Please change the field name with yours</p>\n\n<pre><code>&lt;?php\nclass MySetti...
2017/04/07
[ "https://wordpress.stackexchange.com/questions/262759", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/83851/" ]
I'm using the Wordpress Plugin Boilerplate to make a plugin and I'm having some trouble outputting a form for users to input configuration options for the said plugin. I have the following methods for a class ``` public function admin_add_menu() { add_menu_page( 'Paypal Me Order', 'Paypal ...
Turns out it was a typo in my functions. I can now see the settings page perfectly!
262,792
<p>I have a child theme for twenty-seventeen and am trying to get the possibility to set sections to a one-column layout while the other ones still have their two-columns layout.</p> <p>There seems to be an <a href="https://wordpress.org/support/topic/remove-two-column-display-for-just-a-single-page/" rel="nofollow no...
[ { "answer_id": 262830, "author": "Martin", "author_id": 117148, "author_profile": "https://wordpress.stackexchange.com/users/117148", "pm_score": 1, "selected": false, "text": "<p>I found an <a href=\"https://wordpress.org/support/topic/applying-one-column-layout-to-a-specific-front-page...
2017/04/07
[ "https://wordpress.stackexchange.com/questions/262792", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117148/" ]
I have a child theme for twenty-seventeen and am trying to get the possibility to set sections to a one-column layout while the other ones still have their two-columns layout. There seems to be an [idea](https://wordpress.org/support/topic/remove-two-column-display-for-just-a-single-page/) for a solution where a page ...
I found an [answer](https://wordpress.org/support/topic/applying-one-column-layout-to-a-specific-front-page-panel/), but maybe there is a better way using page-templates and applying the change directly. For now, it's possible to apply the following in the stylesheet: ``` body.page-two-column:not(.archive) #primary #...
262,796
<p>I built a custom post type where we can find a standard textarea/tinymce generated by <code>wp_editor()</code> and I'm facing an issue for the saving part.</p> <p>If I save the content with the following code : </p> <pre><code>update_post_meta( $post_id, $prefix.'content', $_POST['content'] ); </code></pre> <p>Ev...
[ { "answer_id": 262918, "author": "Melch Wanga", "author_id": 117213, "author_profile": "https://wordpress.stackexchange.com/users/117213", "pm_score": 2, "selected": false, "text": "<p>Try </p>\n\n<pre><code>//save this in the database\n$content=sanitize_text_field( htmlentities($_POST['...
2017/04/07
[ "https://wordpress.stackexchange.com/questions/262796", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117153/" ]
I built a custom post type where we can find a standard textarea/tinymce generated by `wp_editor()` and I'm facing an issue for the saving part. If I save the content with the following code : ``` update_post_meta( $post_id, $prefix.'content', $_POST['content'] ); ``` Everything is working fine but there is no sec...
In short: it is in dependence of your context, the data inside your editor. `wp_kses()` is really helpful, and you can define your custom allowed HTML tags. Alternative, you can use the default functions, like [`wp_kses_post`](https://codex.wordpress.org/Function_Reference/wp_kses_post) or [`wp_kses_data`](https://cod...
262,801
<p>I have this code below, and I wish to show each link of each post, but I keep getting same link to all posts which is the link of the page.</p> <pre><code>$args = array('posts_per_page' =&gt; 5,'order' =&gt; 'DESC'); $rp = new WP_Query($args); if($rp-&gt;have_posts()) : while($rp-&gt;have_posts()) : $rp-&gt;the_pos...
[ { "answer_id": 262802, "author": "Toir", "author_id": 117156, "author_profile": "https://wordpress.stackexchange.com/users/117156", "pm_score": 1, "selected": false, "text": "<pre><code>$args = array('posts_per_page' =&gt; 5, 'order' =&gt; 'DESC');\n$rp = new WP_Query($args);\nif ($rp-...
2017/04/07
[ "https://wordpress.stackexchange.com/questions/262801", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117136/" ]
I have this code below, and I wish to show each link of each post, but I keep getting same link to all posts which is the link of the page. ``` $args = array('posts_per_page' => 5,'order' => 'DESC'); $rp = new WP_Query($args); if($rp->have_posts()) : while($rp->have_posts()) : $rp->the_post(); the_title(); $link...
Don't forget to use `esc_url()` ``` echo '<a href="'. esc_url( $link ).'">Welcome</a>'; ``` Also try this: `get_permalink( get_the_ID() );`
262,804
<p>I am following an example on <a href="https://codex.wordpress.org/AJAX_in_Plugins" rel="nofollow noreferrer">AJAX in Plugins</a> on Wordpress website. It's very simple example, and I am trying to modify the example as I intend.</p> <p>What I am trying to achieve is simple:</p> <ul> <li>When a new option is selecte...
[ { "answer_id": 262806, "author": "kiarashi", "author_id": 68619, "author_profile": "https://wordpress.stackexchange.com/users/68619", "pm_score": 0, "selected": false, "text": "<p>Try adding <code>type : 'post',</code> inside <code>data = {...}</code>\nAlso, I'm missing 'security' inside...
2017/04/07
[ "https://wordpress.stackexchange.com/questions/262804", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116656/" ]
I am following an example on [AJAX in Plugins](https://codex.wordpress.org/AJAX_in_Plugins) on Wordpress website. It's very simple example, and I am trying to modify the example as I intend. What I am trying to achieve is simple: * When a new option is selected in select/option dropdown, detect the selected value * P...
**The simple answer:** Don't bother with the Admin AJAX API, use the REST API! Tell WordPress about your endpoint: ``` add_action( 'rest_api_init', function () { // register dongsan/v1/whatever register_rest_route( 'dongsan/v1', '/whatever/', array( 'methods' => 'POST', // use POST to call it ...
262,823
<p>After using WPML Media, a plugin that creates duplicates of each image for each language, we now have almost 100,000 duplicate images that we're not going to use and need to get rid of.</p> <p>We need to not only delete these from the filesystem itself, but also need to make sure that deleting all references in the...
[ { "answer_id": 262835, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 5, "selected": true, "text": "<p>You can try this (untested) modification to the answer you linked to by @something</p>\n\n<pre><code>wp post d...
2017/04/07
[ "https://wordpress.stackexchange.com/questions/262823", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/37934/" ]
After using WPML Media, a plugin that creates duplicates of each image for each language, we now have almost 100,000 duplicate images that we're not going to use and need to get rid of. We need to not only delete these from the filesystem itself, but also need to make sure that deleting all references in the database ...
You can try this (untested) modification to the answer you linked to by @something ``` wp post delete $(wp post list --post_type='attachment' --format=ids --post_parent=0) ``` to delete attachments **without parents**. To target a given `mime type`, e.g. `image/jpeg` try: ``` wp post delete $(wp post list --post_t...
262,832
<p>I have this simple code below:</p> <pre><code>function func1() { echo "this is amazing"; } add_action('reko_hook','func1'); </code></pre> <p>Now, I know that I could use <strong><em>reko_hook();</em></strong> either inside <strong><em>index.php</em></strong> or <strong><em>page.php</em></strong> where I want, but...
[ { "answer_id": 262835, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 5, "selected": true, "text": "<p>You can try this (untested) modification to the answer you linked to by @something</p>\n\n<pre><code>wp post d...
2017/04/07
[ "https://wordpress.stackexchange.com/questions/262832", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117136/" ]
I have this simple code below: ``` function func1() { echo "this is amazing"; } add_action('reko_hook','func1'); ``` Now, I know that I could use ***reko\_hook();*** either inside ***index.php*** or ***page.php*** where I want, but I was wondering if there are more pre-defined hooks such as '***init***'. For examp...
You can try this (untested) modification to the answer you linked to by @something ``` wp post delete $(wp post list --post_type='attachment' --format=ids --post_parent=0) ``` to delete attachments **without parents**. To target a given `mime type`, e.g. `image/jpeg` try: ``` wp post delete $(wp post list --post_t...
262,862
<p><strong>SOLVED</strong></p> <p>See my answer below; I cannot immediately accept it.</p> <hr> <p><strong>Original post</strong></p> <p>I made a custom post type of <code>sector</code>:</p> <pre><code>register_post_type( 'sector', array( 'labels' =&gt; array( 'name' =&gt; __( 'Sectors' ), 'singu...
[ { "answer_id": 262873, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 0, "selected": false, "text": "<p>The first thing I would try for the main issue is to delete the \"sector\" post called \"Hotels &amp; Hos...
2017/04/07
[ "https://wordpress.stackexchange.com/questions/262862", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/39063/" ]
**SOLVED** See my answer below; I cannot immediately accept it. --- **Original post** I made a custom post type of `sector`: ``` register_post_type( 'sector', array( 'labels' => array( 'name' => __( 'Sectors' ), 'singular_name' => __( 'Sector' ) ), 'public' => true, 'has_archive' => f...
I installed Monkeyman Rewrite Analyzer <https://wordpress.org/support/plugin/monkeyman-rewrite-analyzer/> which helped a great deal. I saw this referenced on Jan Fabry's detailed answer on [this post](https://wordpress.stackexchange.com/questions/5413/need-help-with-add-rewrite-rule) which also helped me. First thing ...
262,890
<p>For the plugin i wrote, AJAX request on the frontend <strong>works properly if i am admin</strong>, but the same thing doesn't work when i try it as <strong>normal user</strong>, it always returns 0.</p> <p>This is plugin's core php file where i am doing all the enqueue and localize stuff:</p> <pre><code>require_o...
[ { "answer_id": 264653, "author": "Aishan", "author_id": 89530, "author_profile": "https://wordpress.stackexchange.com/users/89530", "pm_score": 1, "selected": false, "text": "<p>Everything has to match here: </p>\n\n<p>JS:<br>\ndata: {<br>\n action: 'save_like',<br>\n ...
2017/04/08
[ "https://wordpress.stackexchange.com/questions/262890", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116595/" ]
For the plugin i wrote, AJAX request on the frontend **works properly if i am admin**, but the same thing doesn't work when i try it as **normal user**, it always returns 0. This is plugin's core php file where i am doing all the enqueue and localize stuff: ``` require_once ( plugin_dir_path(__FILE__) . 'like-user-re...
As mmm didn't post an answer but just wrote a comment, here is the answer: As the documentation for [wp\_ajax](https://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_(action)) states in its notes, the hook only fires for **logged in users**. If you want to use an ajax call on the frontend for users that are ...
262,960
<p><strong>It works, the tags are displayed in the loop, But when entering one of the tags appears the error 404</strong> I have also created a template tag-pizza.php</p> <p>Here code of the tags</p> <pre><code>add_action( 'init', 'create_tag_taxonomies', 0 ); function create_tag_taxonomies() { // Add new taxonomy...
[ { "answer_id": 262943, "author": "Abhishek Pandey", "author_id": 114826, "author_profile": "https://wordpress.stackexchange.com/users/114826", "pm_score": -1, "selected": false, "text": "<p>Put this CODE in your theme's <code>functions.php</code> file:</p>\n\n<pre><code>function admin_de...
2017/04/08
[ "https://wordpress.stackexchange.com/questions/262960", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115933/" ]
**It works, the tags are displayed in the loop, But when entering one of the tags appears the error 404** I have also created a template tag-pizza.php Here code of the tags ``` add_action( 'init', 'create_tag_taxonomies', 0 ); function create_tag_taxonomies() { // Add new taxonomy, NOT hierarchical (like tags) $...
You can use the `is_user_logged_in()` and `is_page (array(1,2,3-page id's))` functions to check. After that you can write the redirection.
262,977
<p>i want to add my css file bootstrap.min.css on top of all css file. I used below code </p> <pre><code>wp_enqueue_style( 'bootstrap_css', 'bootstrap.min.css' ); </code></pre> <p>but it add css below theme css file .</p> <p>Issue is that i do not want to modify theme file and want to do from plugin only. I there wa...
[ { "answer_id": 262943, "author": "Abhishek Pandey", "author_id": 114826, "author_profile": "https://wordpress.stackexchange.com/users/114826", "pm_score": -1, "selected": false, "text": "<p>Put this CODE in your theme's <code>functions.php</code> file:</p>\n\n<pre><code>function admin_de...
2017/04/09
[ "https://wordpress.stackexchange.com/questions/262977", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/70832/" ]
i want to add my css file bootstrap.min.css on top of all css file. I used below code ``` wp_enqueue_style( 'bootstrap_css', 'bootstrap.min.css' ); ``` but it add css below theme css file . Issue is that i do not want to modify theme file and want to do from plugin only. I there way i can add my css after tag usi...
You can use the `is_user_logged_in()` and `is_page (array(1,2,3-page id's))` functions to check. After that you can write the redirection.
263,008
<p>I have my wordpress server set up using php, mysql, and apache on my raspberry pi. I also have a dynamic dns hostname and configured my router's port forwardiing settings. </p> <p>When trying to access my server from outside of my local LAN, when I type in my dynamic dns host, (for example, my phone on 4G mobile ne...
[ { "answer_id": 263058, "author": "JItendra Rana", "author_id": 87433, "author_profile": "https://wordpress.stackexchange.com/users/87433", "pm_score": 2, "selected": true, "text": "<p>Change the Site URL in Options Table.</p>\n<pre><code>UPDATE `wp_options` SET `option_value` = 'YOUR_...
2017/04/09
[ "https://wordpress.stackexchange.com/questions/263008", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117216/" ]
I have my wordpress server set up using php, mysql, and apache on my raspberry pi. I also have a dynamic dns hostname and configured my router's port forwardiing settings. When trying to access my server from outside of my local LAN, when I type in my dynamic dns host, (for example, my phone on 4G mobile network or a...
Change the Site URL in Options Table. ``` UPDATE `wp_options` SET `option_value` = 'YOUR_SITE_URL' WHERE `option_name` = 'siteurl' OR `option_name` = 'home'; ``` Also change the static URLs in your post content. ``` UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, '192.168.0.18/YOUR_LOCAL_SITE_URL/...
263,029
<p>I'd like to add some custom HTML and jQuery to a page built with the page.php template. I know how to do the HTML and jQuery I want in functions.php but I'm not sure how to get a hook into page.php where I want it so I can get into functions.php. Currently the page I want to modify has been built with Visual Compos...
[ { "answer_id": 263058, "author": "JItendra Rana", "author_id": 87433, "author_profile": "https://wordpress.stackexchange.com/users/87433", "pm_score": 2, "selected": true, "text": "<p>Change the Site URL in Options Table.</p>\n<pre><code>UPDATE `wp_options` SET `option_value` = 'YOUR_...
2017/04/09
[ "https://wordpress.stackexchange.com/questions/263029", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/87684/" ]
I'd like to add some custom HTML and jQuery to a page built with the page.php template. I know how to do the HTML and jQuery I want in functions.php but I'm not sure how to get a hook into page.php where I want it so I can get into functions.php. Currently the page I want to modify has been built with Visual Composer, ...
Change the Site URL in Options Table. ``` UPDATE `wp_options` SET `option_value` = 'YOUR_SITE_URL' WHERE `option_name` = 'siteurl' OR `option_name` = 'home'; ``` Also change the static URLs in your post content. ``` UPDATE `wp_posts` SET `post_content` = REPLACE(post_content, '192.168.0.18/YOUR_LOCAL_SITE_URL/...
263,067
<p>I'm trying to list posts in a custom post type, within a layout like following.</p> <p><a href="https://i.stack.imgur.com/nIxPB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nIxPB.jpg" alt="Layout"></a> </p> <p>html for below layout like this.</p> <pre><code>&lt;div class="col-md-4 col-sm-6"...
[ { "answer_id": 263076, "author": "Rishabh", "author_id": 81621, "author_profile": "https://wordpress.stackexchange.com/users/81621", "pm_score": 2, "selected": true, "text": "<p>You can set your custom loop something like this</p>\n\n<pre><code>$a=2;\n//In while loop counter increments b...
2017/04/10
[ "https://wordpress.stackexchange.com/questions/263067", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115607/" ]
I'm trying to list posts in a custom post type, within a layout like following. [![Layout](https://i.stack.imgur.com/nIxPB.jpg)](https://i.stack.imgur.com/nIxPB.jpg) html for below layout like this. ``` <div class="col-md-4 col-sm-6"> PROFILE - 1 </div> <div class="col-md-4 col-sm-6"> </div> <di...
You can set your custom loop something like this ``` $a=2; //In while loop counter increments by one $counter++ if( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post(); if($a%3!=0){ //Here write function to display title and discription ?> <div class="col-md-4 col-sm-6"> ...
263,086
<p>I am trying to add pagination to my custom WPQuery loop.</p> <p>I tried pretty much every trick in the book but it does not work.</p> <p>Any ideas on that ? Thank you in advance.</p> <pre><code>&lt;div class="container"&lt;?php if($background_color != "") { echo " style='background-color:". $background_color ."'"...
[ { "answer_id": 263098, "author": "Aniruddha Gawade", "author_id": 101818, "author_profile": "https://wordpress.stackexchange.com/users/101818", "pm_score": -1, "selected": false, "text": "<p>As far as I remember, the functions you are using uses global <code>$wp_query</code>. So instead ...
2017/04/10
[ "https://wordpress.stackexchange.com/questions/263086", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115305/" ]
I am trying to add pagination to my custom WPQuery loop. I tried pretty much every trick in the book but it does not work. Any ideas on that ? Thank you in advance. ``` <div class="container"<?php if($background_color != "") { echo " style='background-color:". $background_color ."'";} ?>> <?php if(isset($qode_op...
As far as I remember, the functions you are using uses global `$wp_query`. So instead of `$fp_query` try: ``` global $wp_query; $args = array(); //your args $wp_query = new WP_Query($args); //your loop next_posts_link(); previous_posts_link(); wp_reset_query(); ``` Also notice that `wp_reset_query()` is after pagin...
263,109
<p>I'm making a translation system for my website and I'm having troubles with URL rewriting. Each page is translated to multiple languages and should have different URLs for each language, e.g.:</p> <pre><code>/en/best-restaurants-in-tokyo /it/migliori-ristoranti-a-tokyo /fr/meilleurs-restaurants-à-tokyo </code></p...
[ { "answer_id": 263098, "author": "Aniruddha Gawade", "author_id": 101818, "author_profile": "https://wordpress.stackexchange.com/users/101818", "pm_score": -1, "selected": false, "text": "<p>As far as I remember, the functions you are using uses global <code>$wp_query</code>. So instead ...
2017/04/10
[ "https://wordpress.stackexchange.com/questions/263109", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/60984/" ]
I'm making a translation system for my website and I'm having troubles with URL rewriting. Each page is translated to multiple languages and should have different URLs for each language, e.g.: ``` /en/best-restaurants-in-tokyo /it/migliori-ristoranti-a-tokyo /fr/meilleurs-restaurants-à-tokyo ``` et cetera. All th...
As far as I remember, the functions you are using uses global `$wp_query`. So instead of `$fp_query` try: ``` global $wp_query; $args = array(); //your args $wp_query = new WP_Query($args); //your loop next_posts_link(); previous_posts_link(); wp_reset_query(); ``` Also notice that `wp_reset_query()` is after pagin...
263,116
<p>I'm writing a plugin that makes searches work only on a particular custom post type and it sorts the results according to the taxonomies the user selects in its backend configuration.</p> <p>The admin can select up to 4 taxonomies of the custom post type: each one is then a sort criterion that must be applied to th...
[ { "answer_id": 263420, "author": "Abhishek Pandey", "author_id": 114826, "author_profile": "https://wordpress.stackexchange.com/users/114826", "pm_score": 0, "selected": false, "text": "<p>You can use <code>tax_query</code> for sorting with taxonomy i.e.</p>\n\n<pre><code> $args = array...
2017/04/10
[ "https://wordpress.stackexchange.com/questions/263116", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84622/" ]
I'm writing a plugin that makes searches work only on a particular custom post type and it sorts the results according to the taxonomies the user selects in its backend configuration. The admin can select up to 4 taxonomies of the custom post type: each one is then a sort criterion that must be applied to the search r...
Unfortunately, although `WP_Query` supports the `'tax_query'` arg, it does not support ordering based on post terms. So you will need to modify the query SQL, as you are doing now. However, you are constructing the `ORDER BY` clause incorrectly, and that is why it is ordering by `post_date`. What you need to do is use ...
263,130
<p>mates, please can you help me with the following sql query attempt. This query controls whether a person has performed a form action for 24 hours.</p> <p>This is the SQL:</p> <pre><code>SELECT min(TIMESTAMPDIFF(DAY, `fecha_inscripcion`, now())) FROM `wp_cf7dbplugin_submits` WHERE `field_name`="cedula" and `field_v...
[ { "answer_id": 263133, "author": "Paul 'Sparrow Hawk' Biron", "author_id": 113496, "author_profile": "https://wordpress.stackexchange.com/users/113496", "pm_score": 2, "selected": false, "text": "<p>The main problem is how you're specifying the custom table name (e.g., <code>$wpdb-&gt;cf...
2017/04/10
[ "https://wordpress.stackexchange.com/questions/263130", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/108342/" ]
mates, please can you help me with the following sql query attempt. This query controls whether a person has performed a form action for 24 hours. This is the SQL: ``` SELECT min(TIMESTAMPDIFF(DAY, `fecha_inscripcion`, now())) FROM `wp_cf7dbplugin_submits` WHERE `field_name`="cedula" and `field_value` = "1144093762" ...
The main problem is how you're specifying the custom table name (e.g., `$wpdb->cf7dbplugin_submits`). `$wpdb` only knows about the "built-in" tables when accessing a table name via `$wpdb->xxx`. To specify access a custom table name, use `{$wpdb->prefix}custom_table_name`. The other thing I notice is that, for securi...
263,140
<p>I am developing a theme using bootstrap, but I am not able to display my posts as I would like.</p> <p>This is how I wanted it to be: <a href="https://i.stack.imgur.com/sEMTp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sEMTp.png" alt="enter image description here"></a></p> <p>But my best res...
[ { "answer_id": 263144, "author": "dev", "author_id": 117342, "author_profile": "https://wordpress.stackexchange.com/users/117342", "pm_score": -1, "selected": false, "text": "<p>I will too suggest you to use Masonry javascript \n<a href=\"http://masonry.desandro.com/\" rel=\"nofollow nor...
2017/04/10
[ "https://wordpress.stackexchange.com/questions/263140", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117341/" ]
I am developing a theme using bootstrap, but I am not able to display my posts as I would like. This is how I wanted it to be: [![enter image description here](https://i.stack.imgur.com/sEMTp.png)](https://i.stack.imgur.com/sEMTp.png) But my best result was that with a eternal loop .... [![enter image description he...
You don't need any plugins to accomplish this. In fact, this is not really a use case for a masonry layout since the heights of the images are all the same. Masonry.js is for varying post heights. You just need a counter to keep track of alternating rows, and each alternating row put the small column first instead of s...
263,149
<p>I am using the SimpleLightbox plugin (<a href="https://wordpress.org/plugins/simplelightbox/" rel="nofollow noreferrer">https://wordpress.org/plugins/simplelightbox/</a>) on a test site: <a href="http://joshrodg.com/theiveys/about" rel="nofollow noreferrer">http://joshrodg.com/theiveys/about</a>.</p> <p>If you clic...
[ { "answer_id": 263144, "author": "dev", "author_id": 117342, "author_profile": "https://wordpress.stackexchange.com/users/117342", "pm_score": -1, "selected": false, "text": "<p>I will too suggest you to use Masonry javascript \n<a href=\"http://masonry.desandro.com/\" rel=\"nofollow nor...
2017/04/10
[ "https://wordpress.stackexchange.com/questions/263149", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9820/" ]
I am using the SimpleLightbox plugin (<https://wordpress.org/plugins/simplelightbox/>) on a test site: <http://joshrodg.com/theiveys/about>. If you click on one of the pictures, SimpleLightbox opens a larger version in a Lightbox. You'll notice that to close the Lightbox you need to click the white "X" in the upper-ri...
You don't need any plugins to accomplish this. In fact, this is not really a use case for a masonry layout since the heights of the images are all the same. Masonry.js is for varying post heights. You just need a counter to keep track of alternating rows, and each alternating row put the small column first instead of s...
263,163
<p>I am integrating an API into my Wordpress website and I am having trouble understanding the instructions on Github as to how to install the API. I am comfortable with using Wordpress themes and plugins but I am new to coding + API.</p> <p>I have downloaded the library from Github and extracted it on my computer. Wh...
[ { "answer_id": 263175, "author": "rudtek", "author_id": 77767, "author_profile": "https://wordpress.stackexchange.com/users/77767", "pm_score": 1, "selected": false, "text": "<p>this line IS your php inlcude path:</p>\n\n<pre><code>require_once(dirname(__FILE__) . 'path_to ChargeBee.php'...
2017/04/10
[ "https://wordpress.stackexchange.com/questions/263163", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117354/" ]
I am integrating an API into my Wordpress website and I am having trouble understanding the instructions on Github as to how to install the API. I am comfortable with using Wordpress themes and plugins but I am new to coding + API. I have downloaded the library from Github and extracted it on my computer. Where should...
this line IS your php inlcude path: ``` require_once(dirname(__FILE__) . 'path_to ChargeBee.php'); ``` you need to change it to something specific to your coding. ie: are you putting this into a theme or a plugin? ( would suggest a plugin) If that were the case you would use something like this: require\_once( CHA...
263,176
<p>I have this weird problem. Trying to enqueue a CSS file on an existing <code>functions.php</code> file and nothing seems to work. This is the pertinent part of the functions file, made by someone else based on TwentySixteen theme :</p> <pre><code>function twentysixteen_scripts() { // Add custom fonts, used in ...
[ { "answer_id": 263175, "author": "rudtek", "author_id": 77767, "author_profile": "https://wordpress.stackexchange.com/users/77767", "pm_score": 1, "selected": false, "text": "<p>this line IS your php inlcude path:</p>\n\n<pre><code>require_once(dirname(__FILE__) . 'path_to ChargeBee.php'...
2017/04/10
[ "https://wordpress.stackexchange.com/questions/263176", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/95156/" ]
I have this weird problem. Trying to enqueue a CSS file on an existing `functions.php` file and nothing seems to work. This is the pertinent part of the functions file, made by someone else based on TwentySixteen theme : ``` function twentysixteen_scripts() { // Add custom fonts, used in the main stylesheet. ...
this line IS your php inlcude path: ``` require_once(dirname(__FILE__) . 'path_to ChargeBee.php'); ``` you need to change it to something specific to your coding. ie: are you putting this into a theme or a plugin? ( would suggest a plugin) If that were the case you would use something like this: require\_once( CHA...
263,185
<p>I'm trying to make a Wordpress blog where the home page shows only the 3 most recent posts, but for the newest of these posts, it shows the entire post (not just the teaser content), and then for the other 2, it shows the teaser content with the "read more" button.</p> <p>I'm currently building all this with the "B...
[ { "answer_id": 263203, "author": "frenchy black", "author_id": 28580, "author_profile": "https://wordpress.stackexchange.com/users/28580", "pm_score": 0, "selected": false, "text": "<p>for the first part of your question i would use this to achieve it</p>\n\n<p><pre><code> // FIRST LOO...
2017/04/11
[ "https://wordpress.stackexchange.com/questions/263185", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117365/" ]
I'm trying to make a Wordpress blog where the home page shows only the 3 most recent posts, but for the newest of these posts, it shows the entire post (not just the teaser content), and then for the other 2, it shows the teaser content with the "read more" button. I'm currently building all this with the "Basic" them...
Add a counter to the query and vary the output depending upon what the count is. You'll need to either directly edit the args to limit to 3 posts\_per\_page or use pre\_get\_posts to do it. pre get posts example (into your functions.php) ``` function hwl_home_pagesize( $query ) { if ( is_home() ) { // Di...
263,215
<p>I am using the below code in functions.php to add custom query variables to my WordPress project.</p> <pre><code>&lt;?php function add_custom_query_var( $vars ){ $vars[] = "brand"; return $vars; } add_filter( 'query_vars', 'add_custom_query_var' ); ?&gt; </code></pre> <p>And then on the content page I am using...
[ { "answer_id": 263236, "author": "Faysal Mahamud", "author_id": 83752, "author_profile": "https://wordpress.stackexchange.com/users/83752", "pm_score": 3, "selected": true, "text": "<p>I am giving you some solutions whatever you want to use.</p>\n\n<blockquote>\n <p>Using plus <a href=\...
2017/04/11
[ "https://wordpress.stackexchange.com/questions/263215", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/81898/" ]
I am using the below code in functions.php to add custom query variables to my WordPress project. ``` <?php function add_custom_query_var( $vars ){ $vars[] = "brand"; return $vars; } add_filter( 'query_vars', 'add_custom_query_var' ); ?> ``` And then on the content page I am using: ``` <?php echo $currentbrand ...
I am giving you some solutions whatever you want to use. > > Using plus <http://myexamplesite.com/store/?brand=nike+adidas+woodland> > > > ``` //Don't decode URL <?php $brand = get_query_var('brand'); $brand = explode('+',$brand); print_r($brand); ?> ``` > > using ,separator <http://myexamplesi...
263,251
<p>I have a custom post type no_resume and when a new post is created in it and a meta that is job_category is assigned to it I want to perform a function in which a mail will be sent to all the user that has that category in their database.</p> <p>I tried <code>save_post</code> and <code>publish_post</code> and check...
[ { "answer_id": 263236, "author": "Faysal Mahamud", "author_id": 83752, "author_profile": "https://wordpress.stackexchange.com/users/83752", "pm_score": 3, "selected": true, "text": "<p>I am giving you some solutions whatever you want to use.</p>\n\n<blockquote>\n <p>Using plus <a href=\...
2017/04/11
[ "https://wordpress.stackexchange.com/questions/263251", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104741/" ]
I have a custom post type no\_resume and when a new post is created in it and a meta that is job\_category is assigned to it I want to perform a function in which a mail will be sent to all the user that has that category in their database. I tried `save_post` and `publish_post` and checked if meta exists in the datab...
I am giving you some solutions whatever you want to use. > > Using plus <http://myexamplesite.com/store/?brand=nike+adidas+woodland> > > > ``` //Don't decode URL <?php $brand = get_query_var('brand'); $brand = explode('+',$brand); print_r($brand); ?> ``` > > using ,separator <http://myexamplesi...
263,265
<p>I know this isn't technically a WordPress issue but since it's on a WP project, I'm posting here hoping others have encountered and resolved a similar issue.</p> <p>I've changed the Blog section of a site I'm working on to News and it all works great, but the one thing I need is for legacy posts using the Blog slug...
[ { "answer_id": 263281, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 0, "selected": false, "text": "<p>I usually have more luck when I put any custom redirects above the WP code. Also you need a / before 'blo...
2017/04/11
[ "https://wordpress.stackexchange.com/questions/263265", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117406/" ]
I know this isn't technically a WordPress issue but since it's on a WP project, I'm posting here hoping others have encountered and resolved a similar issue. I've changed the Blog section of a site I'm working on to News and it all works great, but the one thing I need is for legacy posts using the Blog slug to redire...
OK, so here's the solution that works for me... ``` <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^blog/(.*) news/$1 [L,R=301] </IfModule> # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{RE...
263,268
<p>I am generating critical CSS for every page and category. At the moment I am inserting the stylesheet through <code>functions.php</code> like this simply using <code>echo</code>.</p> <pre><code>function criticalCSS_wp_head() { if (is_front_page() ){ echo '&lt;style&gt;'; include get_stylesheet_directory()...
[ { "answer_id": 263272, "author": "user3135691", "author_id": 59755, "author_profile": "https://wordpress.stackexchange.com/users/59755", "pm_score": 1, "selected": true, "text": "<p>You can do it like this, put it in your <code>functions.php</code> :</p>\n\n<p>This is the correct way of ...
2017/04/11
[ "https://wordpress.stackexchange.com/questions/263268", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/77054/" ]
I am generating critical CSS for every page and category. At the moment I am inserting the stylesheet through `functions.php` like this simply using `echo`. ``` function criticalCSS_wp_head() { if (is_front_page() ){ echo '<style>'; include get_stylesheet_directory() . '/css/critical/ccss-index.min.css'; ...
You can do it like this, put it in your `functions.php` : This is the correct way of doing it "the WordPress way". ``` <?php // Check if function exisits if (!function_exists('rg_templateScriptSetup')) { // if not, create one function rg_templateScriptSetup() { // Register style...
263,293
<p>Final state: As Nathan Johnson stated, I change my plug in to a class, still can't use post id in increment_like function...</p> <pre><code>&lt;?php .... //irrelevant parts skipped class wpse_263293 { protected $ID; //* Add actions on init public function init() { add_action( 'the_post', [ $this, '...
[ { "answer_id": 263290, "author": "rudtek", "author_id": 77767, "author_profile": "https://wordpress.stackexchange.com/users/77767", "pm_score": 0, "selected": false, "text": "<p>The best way to figure out what is going on is to disable your plugins and see if it goes away.</p>\n\n<p>Rena...
2017/04/11
[ "https://wordpress.stackexchange.com/questions/263293", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117351/" ]
Final state: As Nathan Johnson stated, I change my plug in to a class, still can't use post id in increment\_like function... ``` <?php .... //irrelevant parts skipped class wpse_263293 { protected $ID; //* Add actions on init public function init() { add_action( 'the_post', [ $this, 'createLikeButton...
Yes, this is a [new Yoast SEO feature](https://yoast.com/what-is-cornerstone-content/). It's a checkbox, so as long a you don't select it in the SEO-metabox, the value will be zero/empty. I presume it's overwritten every time the post is saved, hence it won't delete or accept a value written directly into the database ...
263,307
<p>I'm new to writing rewrite rules in WordPress and I want to make sure I'm not going about this the wrong way.</p> <p><strong>My goal</strong>: to use random numbers and letters as the URL ending for my custom post type <code>project</code> pages</p> <p>My code below is what I've attempted so far ...</p> <h3>function...
[ { "answer_id": 263290, "author": "rudtek", "author_id": 77767, "author_profile": "https://wordpress.stackexchange.com/users/77767", "pm_score": 0, "selected": false, "text": "<p>The best way to figure out what is going on is to disable your plugins and see if it goes away.</p>\n\n<p>Rena...
2017/04/11
[ "https://wordpress.stackexchange.com/questions/263307", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/113595/" ]
I'm new to writing rewrite rules in WordPress and I want to make sure I'm not going about this the wrong way. **My goal**: to use random numbers and letters as the URL ending for my custom post type `project` pages My code below is what I've attempted so far ... ### functions.php ``` // Create a random string and s...
Yes, this is a [new Yoast SEO feature](https://yoast.com/what-is-cornerstone-content/). It's a checkbox, so as long a you don't select it in the SEO-metabox, the value will be zero/empty. I presume it's overwritten every time the post is saved, hence it won't delete or accept a value written directly into the database ...
263,337
<p>I know this question has been asked before, and I've already referenced the following questions here:</p> <p><a href="https://wordpress.stackexchange.com/questions/233184/child-theme-not-overriding-parent-theme">Child Theme Not Overriding Parent Theme</a></p> <p><a href="https://wordpress.stackexchange.com/questio...
[ { "answer_id": 263290, "author": "rudtek", "author_id": 77767, "author_profile": "https://wordpress.stackexchange.com/users/77767", "pm_score": 0, "selected": false, "text": "<p>The best way to figure out what is going on is to disable your plugins and see if it goes away.</p>\n\n<p>Rena...
2017/04/12
[ "https://wordpress.stackexchange.com/questions/263337", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/39316/" ]
I know this question has been asked before, and I've already referenced the following questions here: [Child Theme Not Overriding Parent Theme](https://wordpress.stackexchange.com/questions/233184/child-theme-not-overriding-parent-theme) [some things in child theme css not overriding parent](https://wordpress.stackex...
Yes, this is a [new Yoast SEO feature](https://yoast.com/what-is-cornerstone-content/). It's a checkbox, so as long a you don't select it in the SEO-metabox, the value will be zero/empty. I presume it's overwritten every time the post is saved, hence it won't delete or accept a value written directly into the database ...
263,348
<p>In WordPress whenever new blog post is created all post details need to be send to third party API. I'm using <strong>save_post</strong> hook for this but not sure whether it's getting called or not This is what I've done so far</p> <pre><code> add_action( 'save_post', 'new_blog_details_send'); function new_blog_...
[ { "answer_id": 263352, "author": "Stender", "author_id": 82677, "author_profile": "https://wordpress.stackexchange.com/users/82677", "pm_score": 2, "selected": false, "text": "<p>A quick way of debugging the save function before redirection - is to</p>\n<pre><code>die(print_r($post_id));...
2017/04/12
[ "https://wordpress.stackexchange.com/questions/263348", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117465/" ]
In WordPress whenever new blog post is created all post details need to be send to third party API. I'm using **save\_post** hook for this but not sure whether it's getting called or not This is what I've done so far ``` add_action( 'save_post', 'new_blog_details_send'); function new_blog_details_send( $post_id ) ...
A quick way of debugging the save function before redirection - is to ``` die(print_r($post_id)); // or var_dump($post_id); ``` this will stop all PHP from continuing and is fast for small debugging where you don't need an entire log. throw that into your function, and see what happens in it - change the variable t...
263,349
<p>I have update woo-commerce in latest version 3.0.1 Because of which some of my functions have been closed like confirm password fields on check out page. my function is</p> <pre><code>add_action( 'woocommerce_checkout_init', 'wc_add_confirm_password_checkout', 10, 1 ); function wc_add_confirm_password_checkout( $c...
[ { "answer_id": 263984, "author": "Matt Aitch", "author_id": 117890, "author_profile": "https://wordpress.stackexchange.com/users/117890", "pm_score": 3, "selected": true, "text": "<p>Please try the modified code below, working on WordPress 4.7.3 with WooCommerce 3.0.3.</p>\n\n<p>Matt.</p...
2017/04/12
[ "https://wordpress.stackexchange.com/questions/263349", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/98743/" ]
I have update woo-commerce in latest version 3.0.1 Because of which some of my functions have been closed like confirm password fields on check out page. my function is ``` add_action( 'woocommerce_checkout_init', 'wc_add_confirm_password_checkout', 10, 1 ); function wc_add_confirm_password_checkout( $checkout ) { ...
Please try the modified code below, working on WordPress 4.7.3 with WooCommerce 3.0.3. Matt. ``` /** * Add a confirm password field to the checkout registration form. */ function o_woocommerce_confirm_password_checkout( $checkout ) { if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) { ...
263,355
<p>I was pulling something from <code>https://CJSHayward.com/books/</code> and found that it did not have any of the dynamically arranged titles. When I went to edit the page, I found a surprise.</p> <p>I had originally entered a hand-typed:</p> <pre><code>&lt;script src="/wp-content/javascripts/wrapped-book-table.cg...
[ { "answer_id": 263984, "author": "Matt Aitch", "author_id": 117890, "author_profile": "https://wordpress.stackexchange.com/users/117890", "pm_score": 3, "selected": true, "text": "<p>Please try the modified code below, working on WordPress 4.7.3 with WooCommerce 3.0.3.</p>\n\n<p>Matt.</p...
2017/04/12
[ "https://wordpress.stackexchange.com/questions/263355", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/87471/" ]
I was pulling something from `https://CJSHayward.com/books/` and found that it did not have any of the dynamically arranged titles. When I went to edit the page, I found a surprise. I had originally entered a hand-typed: ``` <script src="/wp-content/javascripts/wrapped-book-table.cgi"></script> ``` However, while t...
Please try the modified code below, working on WordPress 4.7.3 with WooCommerce 3.0.3. Matt. ``` /** * Add a confirm password field to the checkout registration form. */ function o_woocommerce_confirm_password_checkout( $checkout ) { if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) { ...
263,447
<p>I'm trying to setup a custom <code>WP_Comment_Query</code> which is ordered by a meta key. (It might be worth mentioning that these comments are being retrieved with AJAX.)</p> <p>It all works fine, until I add in pagination into the query args. </p> <pre><code>$orderby = 'top-comments'; $args = array( 'pos...
[ { "answer_id": 263940, "author": "cjbj", "author_id": 75495, "author_profile": "https://wordpress.stackexchange.com/users/75495", "pm_score": 2, "selected": false, "text": "<p>If you take a look at the <a href=\"https://developer.wordpress.org/reference/classes/wp_comment_query/\" rel=\"...
2017/04/12
[ "https://wordpress.stackexchange.com/questions/263447", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22588/" ]
I'm trying to setup a custom `WP_Comment_Query` which is ordered by a meta key. (It might be worth mentioning that these comments are being retrieved with AJAX.) It all works fine, until I add in pagination into the query args. ``` $orderby = 'top-comments'; $args = array( 'post_id' => $post_id, 'type' => '...
The goal was to paginate comments, showing comments with the highest `comment_rating` meta value first. Thanks to the answer of cjbj and the comments by Milo and birgire I figured out the rather unintuitive solution to the issue. By using `number`and `offset` I was able to make the results in the proper order, but pa...
263,448
<p>I'm building a custom theme and I want to create a helper class for handling creation of metaboxes in admin panel. I have my class declared like this:</p> <p> <pre><code>namespace ci\wp; Metaboxes::init(); class Metaboxes { private static $instance; private static $post; private static $metaboxesPa...
[ { "answer_id": 263489, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 2, "selected": false, "text": "<p>You're actually calling the <code>add_meta_box()</code> function before it's defined, when you run this direc...
2017/04/12
[ "https://wordpress.stackexchange.com/questions/263448", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33112/" ]
I'm building a custom theme and I want to create a helper class for handling creation of metaboxes in admin panel. I have my class declared like this: ``` namespace ci\wp; Metaboxes::init(); class Metaboxes { private static $instance; private static $post; private static $metaboxesPath = TEMPLATEPATH ....
You're actually calling the `add_meta_box()` function before it's defined, when you run this directly: ``` \ci\wp\Metaboxes::addMetabox( 'front_page_slide_settings', 'Slide settings', 'page', 'normal', 'high' ); ``` You don't mention where you run it, but it's too early or you run it in the f...
263,451
<p>I am trying to create a loop for a custom post type that first calculates how many posts it contains. If it only contains one post, it should simply display the content area of the post. If the post contains more than 1 post it should display the excerpts of all the posts in the loop. Has anyone figured this out?</p...
[ { "answer_id": 263452, "author": "Abdul Awal Uzzal", "author_id": 31449, "author_profile": "https://wordpress.stackexchange.com/users/31449", "pm_score": 1, "selected": false, "text": "<p>Please try this code &amp; let me know the result (I've not tested)</p>\n\n<pre><code>&lt;?php\n$pos...
2017/04/13
[ "https://wordpress.stackexchange.com/questions/263451", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117542/" ]
I am trying to create a loop for a custom post type that first calculates how many posts it contains. If it only contains one post, it should simply display the content area of the post. If the post contains more than 1 post it should display the excerpts of all the posts in the loop. Has anyone figured this out?
<https://codex.wordpress.org/Class_Reference/WP_Query#Properties> `found_posts` is the total number of posts returned by the query. example code: ``` <?php $args = array( 'post_type' => 'your_custom' ); $custom_query = new WP_Query( $args ); if( $custom_query->have_posts() ) { $number_of_posts = $custom_query->f...
263,466
<p>In Plugins > Add New screen, the plugin table gets automatically filtered as I type the name of a plugin in the search field. Is it possible to disable this functionality and have the table update only after I hit return?</p> <p>The answer may lie in wp-admin/includes/plugin-install.php and/or wp-admin/includes/aja...
[ { "answer_id": 263452, "author": "Abdul Awal Uzzal", "author_id": 31449, "author_profile": "https://wordpress.stackexchange.com/users/31449", "pm_score": 1, "selected": false, "text": "<p>Please try this code &amp; let me know the result (I've not tested)</p>\n\n<pre><code>&lt;?php\n$pos...
2017/04/13
[ "https://wordpress.stackexchange.com/questions/263466", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14380/" ]
In Plugins > Add New screen, the plugin table gets automatically filtered as I type the name of a plugin in the search field. Is it possible to disable this functionality and have the table update only after I hit return? The answer may lie in wp-admin/includes/plugin-install.php and/or wp-admin/includes/ajax-actions....
<https://codex.wordpress.org/Class_Reference/WP_Query#Properties> `found_posts` is the total number of posts returned by the query. example code: ``` <?php $args = array( 'post_type' => 'your_custom' ); $custom_query = new WP_Query( $args ); if( $custom_query->have_posts() ) { $number_of_posts = $custom_query->f...
263,470
<p>I'm trying to figure out how to let Wordpress update on my server, without needing FTP credentials. In <code>/etc/php/7.0/fpm/pool.d/www.conf</code> I have:</p> <pre><code>listen.owner = www-data listen.group = www-data </code></pre> <p>The problem I think is the way VestaCP is setup with the files:</p> <pre><co...
[ { "answer_id": 263479, "author": "Niels van Renselaar", "author_id": 67313, "author_profile": "https://wordpress.stackexchange.com/users/67313", "pm_score": 1, "selected": false, "text": "<p>Shouldn't u add rachel to the www-data group?</p>\n\n<pre><code>sudo usermod -aG www-data rachel\...
2017/04/13
[ "https://wordpress.stackexchange.com/questions/263470", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/74617/" ]
I'm trying to figure out how to let Wordpress update on my server, without needing FTP credentials. In `/etc/php/7.0/fpm/pool.d/www.conf` I have: ``` listen.owner = www-data listen.group = www-data ``` The problem I think is the way VestaCP is setup with the files: ``` root@com:/home/rachel/web/site.co.uk/public_sh...
Shouldn't u add rachel to the www-data group? ``` sudo usermod -aG www-data rachel ``` More details <https://stackoverflow.com/a/19620585/1173445>
263,492
<p>I am trying to load CSS and Javscripts through the functions. CSS are loading, but dont know what mistake has been done that javascripts and Jquery are not loading through the functions method.</p> <p>I tried by directly loading scripts through the head section and it worked, but by functions method it is not loadi...
[ { "answer_id": 263494, "author": "Frits", "author_id": 93169, "author_profile": "https://wordpress.stackexchange.com/users/93169", "pm_score": 1, "selected": false, "text": "<p>Once you register your script, you need to enqueue it.</p>\n\n<p>The below assumes you are using a theme:</p>\n...
2017/04/13
[ "https://wordpress.stackexchange.com/questions/263492", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
I am trying to load CSS and Javscripts through the functions. CSS are loading, but dont know what mistake has been done that javascripts and Jquery are not loading through the functions method. I tried by directly loading scripts through the head section and it worked, but by functions method it is not loading. I am p...
There are several fundamental problems with what you're trying to do that prevent you reaching your goal The Problems ------------ ### Naming You register 2 scripts, but you name them both 'custom'. How is WordPress supposed to know which script you meant when you later tell it to display 'custom'? ``` /* Register ...
263,493
<h2>I Have Wordpress Multisite as Following</h2> <ol> <li><p>multisite on domain.com </p></li> <li><p>multisite on sub1.domain.com</p></li> <li><p>multisite on sub2.domain.com</p></li> <li><p>multisite on sub3.domain.com</p> <p><strong>X multisite on subx.domain.com</strong></p></li> </ol> <hr> <ul> <li><p>All Site...
[ { "answer_id": 263506, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 2, "selected": false, "text": "<blockquote>\n <p>I want to use same user and user meta for all site meaning that\n everysite will use same u...
2017/04/13
[ "https://wordpress.stackexchange.com/questions/263493", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117067/" ]
I Have Wordpress Multisite as Following --------------------------------------- 1. multisite on domain.com 2. multisite on sub1.domain.com 3. multisite on sub2.domain.com 4. multisite on sub3.domain.com **X multisite on subx.domain.com** --- * All Sites are on Same Database. ( If There Is Way to Use Different Datab...
I just got this on Web this works for me it need some work --- kinsta.com/blog/share-logins-wordpress
263,521
<p>I want to remove a menu sub-item. But i cant'find the right item to delete. It is a plug caled "New User Approve". And the slug is :/wp-admin/users.php?page=new-user-approve-admin</p> <p>I don't want to disable the plugin and the functions, just the sub-menu item.</p> <p>I don't come further than: </p> <pre><code...
[ { "answer_id": 263524, "author": "joetek", "author_id": 62298, "author_profile": "https://wordpress.stackexchange.com/users/62298", "pm_score": -1, "selected": true, "text": "<p>You'd want to add this code:</p>\n\n<pre><code>add_action( 'admin_menu', 'remove_admin_menus', 999 );\nfunctio...
2017/04/13
[ "https://wordpress.stackexchange.com/questions/263521", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/57885/" ]
I want to remove a menu sub-item. But i cant'find the right item to delete. It is a plug caled "New User Approve". And the slug is :/wp-admin/users.php?page=new-user-approve-admin I don't want to disable the plugin and the functions, just the sub-menu item. I don't come further than: ``` add_action( 'admin_menu'...
You'd want to add this code: ``` add_action( 'admin_menu', 'remove_admin_menus', 999 ); function remove_admin_menus() { remove_submenu_page( 'users.php', 'new-user-approve-admin' ); } ```
263,527
<p>I have created custom template (Sell items) for pages. I want to display posts from specific category on page using that custom template. That is working perfectly but only if there are at least one post in the category. If there is nothing it will give following error.</p> <p>What might be wrong?</p> <p><em>Notic...
[ { "answer_id": 263529, "author": "ciaika", "author_id": 48497, "author_profile": "https://wordpress.stackexchange.com/users/48497", "pm_score": 1, "selected": false, "text": "<p>You can use WP_Query instead the get_posts() function:</p>\n\n<pre>\n $args = array( 'numberposts' => 20, 'ca...
2017/04/13
[ "https://wordpress.stackexchange.com/questions/263527", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92020/" ]
I have created custom template (Sell items) for pages. I want to display posts from specific category on page using that custom template. That is working perfectly but only if there are at least one post in the category. If there is nothing it will give following error. What might be wrong? *Notice: Undefined offset:...
You can use WP\_Query instead the get\_posts() function: ``` $args = array( 'numberposts' => 20, 'category_name' => 'sell-items' ); $wp_query = new WP_Query($args); if ($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); echo '<li><a href="'.get_the_permalink().'">'.get_the_titl...
263,558
<p>I am already filtering some custom posts depending on a querystring in pre_get_posts:</p> <pre><code>if( $query-&gt;is_main_query() ) { if( is_post_type_archive( 'events' ) ) { if ($_GET['status']) { $retrieved_status = $_GET['status']; $query-&gt;set('meta_key', 'event_status');...
[ { "answer_id": 264745, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 2, "selected": false, "text": "<p>WP_Query has a case for this called a <a href=\"https://codex.wordpress.org/Class_Reference/WP_Query#Custom...
2017/04/13
[ "https://wordpress.stackexchange.com/questions/263558", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/108897/" ]
I am already filtering some custom posts depending on a querystring in pre\_get\_posts: ``` if( $query->is_main_query() ) { if( is_post_type_archive( 'events' ) ) { if ($_GET['status']) { $retrieved_status = $_GET['status']; $query->set('meta_key', 'event_status'); $quer...
Use WP\_Query to select any post based on meta key and value. You can also sort posts Ex: ``` $args = array( 'post_type' => 'events', 'orderby' => 'meta_value_num', //probably you will need this because the value is date 'meta_key' => 'event_date', 'meta_query' => array( 'relation' => 'AN...
263,574
<p>I have to display a button that links to a tag, but I have to hide the button if tag doesn't exists to avoid broken links.</p> <p>How can I check if a specific tag exists inside wp database?</p> <p><strong>This is what I have so far:</strong></p> <pre><code> $tag_path = '/tag/testing/'; if( !$page = get_p...
[ { "answer_id": 263575, "author": "Abdul Awal Uzzal", "author_id": 31449, "author_profile": "https://wordpress.stackexchange.com/users/31449", "pm_score": 4, "selected": true, "text": "<p>I think you're looking for <a href=\"https://codex.wordpress.org/Function_Reference/term_exists\" rel...
2017/04/13
[ "https://wordpress.stackexchange.com/questions/263574", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18693/" ]
I have to display a button that links to a tag, but I have to hide the button if tag doesn't exists to avoid broken links. How can I check if a specific tag exists inside wp database? **This is what I have so far:** ``` $tag_path = '/tag/testing/'; if( !$page = get_page_by_path( $tag_path ) ){ //hide b...
I think you're looking for [`term_exists`](https://codex.wordpress.org/Function_Reference/term_exists) function. Example Code: ``` <?php $term = term_exists('tag1', 'post_tag'); if ($term !== 0 && $term !== null) { echo "'tag1' post_tag exists!"; } else { echo "'tag1' post_tag does not exist!"; } ?> ```
263,595
<p>Please help if any one can.I tried it to create uploads folder manually and then upload media in upload folder but then i can not get my media file in WordPress dashboard media file.</p>
[ { "answer_id": 263575, "author": "Abdul Awal Uzzal", "author_id": 31449, "author_profile": "https://wordpress.stackexchange.com/users/31449", "pm_score": 4, "selected": true, "text": "<p>I think you're looking for <a href=\"https://codex.wordpress.org/Function_Reference/term_exists\" rel...
2017/04/14
[ "https://wordpress.stackexchange.com/questions/263595", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117635/" ]
Please help if any one can.I tried it to create uploads folder manually and then upload media in upload folder but then i can not get my media file in WordPress dashboard media file.
I think you're looking for [`term_exists`](https://codex.wordpress.org/Function_Reference/term_exists) function. Example Code: ``` <?php $term = term_exists('tag1', 'post_tag'); if ($term !== 0 && $term !== null) { echo "'tag1' post_tag exists!"; } else { echo "'tag1' post_tag does not exist!"; } ?> ```
263,598
<p>I want to adjust or edit below codes to show all custom post types without showing page numbers. I just want to show all items in one page. I don't want to keep pagination here. What thing I need to edit or add in this below codes?</p> <pre><code>// show all active coupons for this store and setup pagination $paged...
[ { "answer_id": 263575, "author": "Abdul Awal Uzzal", "author_id": 31449, "author_profile": "https://wordpress.stackexchange.com/users/31449", "pm_score": 4, "selected": true, "text": "<p>I think you're looking for <a href=\"https://codex.wordpress.org/Function_Reference/term_exists\" rel...
2017/04/14
[ "https://wordpress.stackexchange.com/questions/263598", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117256/" ]
I want to adjust or edit below codes to show all custom post types without showing page numbers. I just want to show all items in one page. I don't want to keep pagination here. What thing I need to edit or add in this below codes? ``` // show all active coupons for this store and setup pagination $paged = (get_query_...
I think you're looking for [`term_exists`](https://codex.wordpress.org/Function_Reference/term_exists) function. Example Code: ``` <?php $term = term_exists('tag1', 'post_tag'); if ($term !== 0 && $term !== null) { echo "'tag1' post_tag exists!"; } else { echo "'tag1' post_tag does not exist!"; } ?> ```
263,611
<p>I've successfully change the HTML for <code>archive-product.php</code> and <code>content-product.php</code> pages. Once I updated to the latest Wordpress I found that all the changes I made just gone.</p> <p>I notice this issue is mentioned everywhere I searched for custom theme development. However, I'm not sure h...
[ { "answer_id": 263612, "author": "Aditya Batra", "author_id": 109696, "author_profile": "https://wordpress.stackexchange.com/users/109696", "pm_score": 0, "selected": false, "text": "<p>Create a woocommerce folder on your root folder and copy the template from the woocommerce plugin (in ...
2017/04/14
[ "https://wordpress.stackexchange.com/questions/263611", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117641/" ]
I've successfully change the HTML for `archive-product.php` and `content-product.php` pages. Once I updated to the latest Wordpress I found that all the changes I made just gone. I notice this issue is mentioned everywhere I searched for custom theme development. However, I'm not sure how to do this for WooCommerce pa...
Make it like this:: ``` my_theme/woocommerce/archive-product.php my_theme/woocommerce/content-product.php ```
263,671
<p>I'm trying to input the numer of the post next to it, but in the reverse order, which means</p> <p>not </p> <p>1 2 3 4</p> <p>but</p> <p>4 3 2 1 .</p> <p>I have succeeded into doing it in the "right" order with this : </p> <pre><code>&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;?...
[ { "answer_id": 263672, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 0, "selected": false, "text": "<p>Strange question. You can create a secondary query or run a hook into <a href=\"https://developer.wordpress...
2017/04/14
[ "https://wordpress.stackexchange.com/questions/263671", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/83660/" ]
I'm trying to input the numer of the post next to it, but in the reverse order, which means not 1 2 3 4 but 4 3 2 1 . I have succeeded into doing it in the "right" order with this : ``` <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php echo $wp_query->current_post + 1; ?> ``` but I can't...
To print a decreasing counter for the main home query, without sticky posts, you can try: ``` // current page number - paged is 0 on the home page, we use 1 instead $_current_page = is_paged() ? get_query_var( 'paged', 1 ) : 1; // posts per page $_ppp = get_query_var( 'posts_per_page', get_option( 'posts...
263,678
<p>I have tried numerous ways to prevent the browser's back button from allowing someone from using it to go back into a visitors logged out profile. The codes I used were supposed to prevent the browser from caching data from the last page visited after logout. They don't work. Wordpress logs the visitor out once they...
[ { "answer_id": 263672, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 0, "selected": false, "text": "<p>Strange question. You can create a secondary query or run a hook into <a href=\"https://developer.wordpress...
2017/04/15
[ "https://wordpress.stackexchange.com/questions/263678", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117689/" ]
I have tried numerous ways to prevent the browser's back button from allowing someone from using it to go back into a visitors logged out profile. The codes I used were supposed to prevent the browser from caching data from the last page visited after logout. They don't work. Wordpress logs the visitor out once they cl...
To print a decreasing counter for the main home query, without sticky posts, you can try: ``` // current page number - paged is 0 on the home page, we use 1 instead $_current_page = is_paged() ? get_query_var( 'paged', 1 ) : 1; // posts per page $_ppp = get_query_var( 'posts_per_page', get_option( 'posts...
263,690
<p>Is there significant risk in not keeping a theme updated?</p> <p>We have various themes which we have purchased and modified. It would be a lot of work to install theme updates and re-implement our changes. Do themes, not kept updated, pose a significant security risk?</p>
[ { "answer_id": 263672, "author": "Howdy_McGee", "author_id": 7355, "author_profile": "https://wordpress.stackexchange.com/users/7355", "pm_score": 0, "selected": false, "text": "<p>Strange question. You can create a secondary query or run a hook into <a href=\"https://developer.wordpress...
2017/04/15
[ "https://wordpress.stackexchange.com/questions/263690", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117705/" ]
Is there significant risk in not keeping a theme updated? We have various themes which we have purchased and modified. It would be a lot of work to install theme updates and re-implement our changes. Do themes, not kept updated, pose a significant security risk?
To print a decreasing counter for the main home query, without sticky posts, you can try: ``` // current page number - paged is 0 on the home page, we use 1 instead $_current_page = is_paged() ? get_query_var( 'paged', 1 ) : 1; // posts per page $_ppp = get_query_var( 'posts_per_page', get_option( 'posts...
263,713
<p>I don't want to use the dropdown menu for sub/child pages on my Wordpress site, I want the pages to be listed in the sidebar on the parent page.</p> <p>This is the code I'm got so far (below), however it doesn't display anything in the sidebar so I'd appreciate some help!</p> <p>This is in my functions.php:</p> <...
[ { "answer_id": 263755, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 2, "selected": true, "text": "<p>When trying to output a function's content, you have to notice whether you want to pass the data to another ...
2017/04/15
[ "https://wordpress.stackexchange.com/questions/263713", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116827/" ]
I don't want to use the dropdown menu for sub/child pages on my Wordpress site, I want the pages to be listed in the sidebar on the parent page. This is the code I'm got so far (below), however it doesn't display anything in the sidebar so I'd appreciate some help! This is in my functions.php: ``` function wpb_list_...
When trying to output a function's content, you have to notice whether you want to pass the data to another function (or something else which you want to feed), or you want to directly print it to the browser. If you use `return`, your function will return the data, so you can use them in a secondary function as below...
263,718
<p>I have registered a new post type and made a custom template to display it. According to WP´s latest support for CPT templates, all it takes to make it available for any given CPT is to place this header on the template file:</p> <pre><code>/** * Template Name: Single Book * Template Post Type: book */ </code></...
[ { "answer_id": 263755, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 2, "selected": true, "text": "<p>When trying to output a function's content, you have to notice whether you want to pass the data to another ...
2017/04/15
[ "https://wordpress.stackexchange.com/questions/263718", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115596/" ]
I have registered a new post type and made a custom template to display it. According to WP´s latest support for CPT templates, all it takes to make it available for any given CPT is to place this header on the template file: ``` /** * Template Name: Single Book * Template Post Type: book */ ``` Then, following t...
When trying to output a function's content, you have to notice whether you want to pass the data to another function (or something else which you want to feed), or you want to directly print it to the browser. If you use `return`, your function will return the data, so you can use them in a secondary function as below...
263,730
<p>Designer new to wordpress here. I want to take the featured image on a post and make it a hero image for the post single page. </p> <p>The way I would normally do this is to create a div, set width to 100%, height to whatever vh I want, and then set background to the image url in the CSS with background size set to...
[ { "answer_id": 263755, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 2, "selected": true, "text": "<p>When trying to output a function's content, you have to notice whether you want to pass the data to another ...
2017/04/16
[ "https://wordpress.stackexchange.com/questions/263730", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117679/" ]
Designer new to wordpress here. I want to take the featured image on a post and make it a hero image for the post single page. The way I would normally do this is to create a div, set width to 100%, height to whatever vh I want, and then set background to the image url in the CSS with background size set to cover. ...
When trying to output a function's content, you have to notice whether you want to pass the data to another function (or something else which you want to feed), or you want to directly print it to the browser. If you use `return`, your function will return the data, so you can use them in a secondary function as below...
263,747
<p>After about 3 days of searching and tinkering, I'm stuck. I'm not a coder, but I like to try.</p> <p>I have a short code that gets a horoscope from a table in my WordPress database (I created the table). However, I have since discovered that short codes don't allow "echo" or "print" to show the output correct. Inst...
[ { "answer_id": 263755, "author": "Johansson", "author_id": 94498, "author_profile": "https://wordpress.stackexchange.com/users/94498", "pm_score": 2, "selected": true, "text": "<p>When trying to output a function's content, you have to notice whether you want to pass the data to another ...
2017/04/16
[ "https://wordpress.stackexchange.com/questions/263747", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117744/" ]
After about 3 days of searching and tinkering, I'm stuck. I'm not a coder, but I like to try. I have a short code that gets a horoscope from a table in my WordPress database (I created the table). However, I have since discovered that short codes don't allow "echo" or "print" to show the output correct. Instead of sho...
When trying to output a function's content, you have to notice whether you want to pass the data to another function (or something else which you want to feed), or you want to directly print it to the browser. If you use `return`, your function will return the data, so you can use them in a secondary function as below...
263,795
<p>I recently dramatically changed the structure of my site and I'm getting errors from pages that existed on the past (and they will probably) exist on the future again.</p> <p>eg: </p> <p>in the past I had 44 pages (<code>example.com/manual-cat/how-to/page/44/</code>) and right now I only have posts to have <code>3...
[ { "answer_id": 263796, "author": "Max", "author_id": 115933, "author_profile": "https://wordpress.stackexchange.com/users/115933", "pm_score": -1, "selected": false, "text": "<p>You can use and edit .htaccess file</p>\n\n<pre><code># Redirect old file path to new file path\nRedirect /man...
2017/04/16
[ "https://wordpress.stackexchange.com/questions/263795", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18693/" ]
I recently dramatically changed the structure of my site and I'm getting errors from pages that existed on the past (and they will probably) exist on the future again. eg: in the past I had 44 pages (`example.com/manual-cat/how-to/page/44/`) and right now I only have posts to have `39 pages`, but I will probably hav...
You can detect non-existent pages only with WordPress. Normal URLs don't point to a physical resource, their path is mapped internally to database content instead. That means you need a WP hook that fires only when no content has been found for an URL. That hook is `404_template`. This is called when WP trys to includ...
263,804
<p>I have a form to create new post and I pass my post_category into post creating array, but it not insert into that category , it insert into Uncategorized category.And I want to see the post using the menu that I created using categories. </p> <p>I pass may data to following array to create post.Its working but it ...
[ { "answer_id": 263810, "author": "mayersdesign", "author_id": 106965, "author_profile": "https://wordpress.stackexchange.com/users/106965", "pm_score": 1, "selected": false, "text": "<p>The post_category parameter has to be an array, try this:</p>\n\n<pre><code>$post = array('post_type'=...
2017/04/17
[ "https://wordpress.stackexchange.com/questions/263804", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117616/" ]
I have a form to create new post and I pass my post\_category into post creating array, but it not insert into that category , it insert into Uncategorized category.And I want to see the post using the menu that I created using categories. I pass may data to following array to create post.Its working but it insert po...
Issue is in following line > > 'post\_category' => array('679') > > > Use `'post_category' => array(679)` without single quote.
263,813
<p>I'm trying to use tags of the single post, as meta keywords.</p> <p>I tried using this:</p> <pre><code>&lt;meta name="keywords" content="&lt;?php the_tags('',',','');?&gt;test&lt;?php }?&gt;"/&gt; </code></pre> <p>It works, but the output is:</p> <pre><code>&lt;meta name="keywords" content="&lt;a href="http://12...
[ { "answer_id": 263814, "author": "Aniruddha Gawade", "author_id": 101818, "author_profile": "https://wordpress.stackexchange.com/users/101818", "pm_score": 3, "selected": false, "text": "<p>Use <code>get_the_tag_list()</code> instead of <code>the_tags()</code>, since <code>the_tags()</co...
2017/04/17
[ "https://wordpress.stackexchange.com/questions/263813", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/110405/" ]
I'm trying to use tags of the single post, as meta keywords. I tried using this: ``` <meta name="keywords" content="<?php the_tags('',',','');?>test<?php }?>"/> ``` It works, but the output is: ``` <meta name="keywords" content="<a href="http://127.0.0.1/1/tag/aquaman/" rel="tag">aquaman</a>,<a href="http://127.0....
The code is tested and working fine. Place this code ``` <?php $posttags = get_the_tags(); if( ! empty( $posttags ) ) : $tags = array(); foreach($posttags as $key => $value){ $tags[] = $value->name; } ?> <meta name="keywords" content="<?php echo implode( ',', $tags...
263,823
<p>In <code>functions.php</code>, I have added the following code</p> <pre><code>function my_custom_js() { echo '&lt;script type="text/javascript" src="//platform-api.sharethis.com/js/sharethis.js#property=58ef5701485778001223c86c&amp;product=inline-share-buttons"&gt;&lt;/script&gt;'; } add_action('wp_head', 'my_c...
[ { "answer_id": 263824, "author": "Mukii kumar", "author_id": 88892, "author_profile": "https://wordpress.stackexchange.com/users/88892", "pm_score": -1, "selected": false, "text": "<p>@rajith try this. This might be helps you-</p>\n\n<pre><code>add_action('wp_head', array($this, 'my_cust...
2017/04/17
[ "https://wordpress.stackexchange.com/questions/263823", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117803/" ]
In `functions.php`, I have added the following code ``` function my_custom_js() { echo '<script type="text/javascript" src="//platform-api.sharethis.com/js/sharethis.js#property=58ef5701485778001223c86c&product=inline-share-buttons"></script>'; } add_action('wp_head', 'my_custom_js'); ``` This gives an error: >...
If [`add_action`](https://developer.wordpress.org/reference/functions/add_action/) is undefined, it means WP is not loaded in the regular way. Assuming we are talking about `functions.php` in the theme folder (and not the `functions.php` in the `wp-includes` folder, which you must not mess with) there should be no prob...
263,827
<p>I been modifying a WordPress theme, and for some specific pages that need a specific design I placed a php file named <code>page-specific-url.php</code> where specific-url is the page I want to show.</p> <p>The problem I am facing is the location of the specific page I need to design is inside of of a category so t...
[ { "answer_id": 263828, "author": "mayersdesign", "author_id": 106965, "author_profile": "https://wordpress.stackexchange.com/users/106965", "pm_score": 0, "selected": false, "text": "<p>This is where body tags are your best friend. I would add the category as a custom body tag using this...
2017/04/17
[ "https://wordpress.stackexchange.com/questions/263827", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117809/" ]
I been modifying a WordPress theme, and for some specific pages that need a specific design I placed a php file named `page-specific-url.php` where specific-url is the page I want to show. The problem I am facing is the location of the specific page I need to design is inside of of a category so the url is `domain.com...
There is a filter called [`theme_page_templates`](https://developer.wordpress.org/reference/hooks/theme_page_templates/) which you can use to force the use of a certain template under certain circumstances. Like this: ``` add_filter ('theme_page_templates', 'wpse263827_filter_theme_page_templates', 20, 3 ); wpse263827...
263,832
<p>i', try added to my site upcoming events, but when i try add via get_post_meta - not working, for example: <a href="http://prntscr.com/exe8oi" rel="nofollow noreferrer">http://prntscr.com/exe8oi</a> i added date, then i use this my code:</p> <pre><code>&lt;?php $today = date('U')*1000;?&gt; ...
[ { "answer_id": 263828, "author": "mayersdesign", "author_id": 106965, "author_profile": "https://wordpress.stackexchange.com/users/106965", "pm_score": 0, "selected": false, "text": "<p>This is where body tags are your best friend. I would add the category as a custom body tag using this...
2017/04/17
[ "https://wordpress.stackexchange.com/questions/263832", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
i', try added to my site upcoming events, but when i try add via get\_post\_meta - not working, for example: <http://prntscr.com/exe8oi> i added date, then i use this my code: ``` <?php $today = date('U')*1000;?> <?php $event = new WP_Query(array( 'post_type'=>'event_i...
There is a filter called [`theme_page_templates`](https://developer.wordpress.org/reference/hooks/theme_page_templates/) which you can use to force the use of a certain template under certain circumstances. Like this: ``` add_filter ('theme_page_templates', 'wpse263827_filter_theme_page_templates', 20, 3 ); wpse263827...
263,845
<p>I have an existing site that has 5 or 6 php pages, with HTML mixed in for some tables and forms. The biggest purpose of the site is to upload CSV files into a database table and then on other pages select certain records from the database and display them in HTML tables. </p> <p>The site works perfectly on my local...
[ { "answer_id": 263849, "author": "Swen", "author_id": 22588, "author_profile": "https://wordpress.stackexchange.com/users/22588", "pm_score": 2, "selected": true, "text": "<p>It really is rather simple. Check out the <a href=\"https://developer.wordpress.org/themes/template-files-section...
2017/04/17
[ "https://wordpress.stackexchange.com/questions/263845", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115321/" ]
I have an existing site that has 5 or 6 php pages, with HTML mixed in for some tables and forms. The biggest purpose of the site is to upload CSV files into a database table and then on other pages select certain records from the database and display them in HTML tables. The site works perfectly on my local server wi...
It really is rather simple. Check out the [Codex on Page Templates](https://developer.wordpress.org/themes/template-files-section/page-template-files/) for more info. 1. Make a copy the existing page.php file located inside your WordPress theme's folder. 2. Rename your *page.php* file to *page-mypage.php* 3. At the ve...
263,848
<p>I have a custom post tipe ("artigo"), and this CPT has a registered taxonomy ("artigo_eixo"), with 3 registered terms in it.</p> <p><strong>I want to show, in that page, a sidebar listing all terms,</strong> <strong><em>except the current term,</em></strong> in the page that lists all posts with that term (<a href=...
[ { "answer_id": 263850, "author": "Aniruddha Gawade", "author_id": 101818, "author_profile": "https://wordpress.stackexchange.com/users/101818", "pm_score": -1, "selected": false, "text": "<p>Possible reason: <code>get_queried_object_id()</code> returns <code>int</code>, whereas <code>exc...
2017/04/17
[ "https://wordpress.stackexchange.com/questions/263848", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/22510/" ]
I have a custom post tipe ("artigo"), and this CPT has a registered taxonomy ("artigo\_eixo"), with 3 registered terms in it. **I want to show, in that page, a sidebar listing all terms,** ***except the current term,*** in the page that lists all posts with that term (<http://localhost/mytaxonomy/current_term/>) Howe...
Turns out there was a function hooking the filter `list_terms_exclusions`, and the return was inside a logically faulty conditional. I fixed it and now the term query exclusion works as intended.
263,911
<p>have a question about best practice for adding fields to author form. The site will post blogs on behalf of another author, but wants an author box at the bottom that would include the "real" authors picture, name, business name, and links to social media. A typical author box won't work since it ties to the author ...
[ { "answer_id": 263914, "author": "Ben HartLenn", "author_id": 6645, "author_profile": "https://wordpress.stackexchange.com/users/6645", "pm_score": 0, "selected": false, "text": "<p>You could use the built in custom fields for most of this, but Advanced Custom Fields will be especially u...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/263911", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117851/" ]
have a question about best practice for adding fields to author form. The site will post blogs on behalf of another author, but wants an author box at the bottom that would include the "real" authors picture, name, business name, and links to social media. A typical author box won't work since it ties to the author pub...
Add the new custom field to the author profile ``` function my_epl_custom_user_contact( $contactmethods ) { $contactmethods['custom'] = __( 'Custom', 'easy-property-listings' ); return $contactmethods; } add_filter ('user_contactmethods','my_epl_custom_user_contact',10,1); ``` Create the HTML output of...
263,936
<p>I'm looking to restrict all users (other than admins) to only be able to upload images e.g JPG's and PNGs allowed for all users but still allow admins to upload pdfs etc. (Or even better would be to only prevent unregistered users from uploading anything other than JPGs and PNGs!)</p> <p>I've been trying the follow...
[ { "answer_id": 263926, "author": "mageDev0688", "author_id": 106772, "author_profile": "https://wordpress.stackexchange.com/users/106772", "pm_score": 4, "selected": false, "text": "<p>According to the wordpress <a href=\"https://codex.wordpress.org/Changing_The_Site_URL\" rel=\"noreferr...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/263936", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117472/" ]
I'm looking to restrict all users (other than admins) to only be able to upload images e.g JPG's and PNGs allowed for all users but still allow admins to upload pdfs etc. (Or even better would be to only prevent unregistered users from uploading anything other than JPGs and PNGs!) I've been trying the following functi...
Try following * If there are caching plugins installed like W3 total cache. Then purge cache first. Or may be disable them for time being * Perform Search and Replace in the database for Old Site URL. You can [Use this Plugin](https://wordpress.org/plugins/search-and-replace/) * Reset Permalinks ( Dashboard >> Settin...
263,950
<p>I am using beneath code im buddypress to show notification of the latest posts posted by users.</p> <p><a href="https://gist.github.com/kishoresahoo/9209b9f6ac69ce21cd6962e7fe21e1b4/6b9d901383da4783f9108ffdc6aa2bb4e671cd44" rel="nofollow noreferrer">https://gist.github.com/kishoresahoo/9209b9f6ac69ce21cd6962e7fe21e...
[ { "answer_id": 263965, "author": "JItendra Rana", "author_id": 87433, "author_profile": "https://wordpress.stackexchange.com/users/87433", "pm_score": 2, "selected": false, "text": "<p>If you check the function for 'publish_post' action. </p>\n\n<pre><code>function bp_post_published_noti...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/263950", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117870/" ]
I am using beneath code im buddypress to show notification of the latest posts posted by users. <https://gist.github.com/kishoresahoo/9209b9f6ac69ce21cd6962e7fe21e1b4/6b9d901383da4783f9108ffdc6aa2bb4e671cd44> The problem is that when a post is posted then only the person who posts the post receive the notification an...
Like JItendra Rana already mentioned, you just send a notification to the author. If all users should get a notification, you must loop through all your users and add a notification to everyone. You get the users with [get\_users](https://codex.wordpress.org/Function_Reference/get_users). Here is the modified code to r...
263,953
<p>I wish to run a cron job that would permanently erase all the posts belonging to some category from the past X days (say, week). This is probably very basic, but I would appreciate some pointers. Thanks.</p>
[ { "answer_id": 263960, "author": "JItendra Rana", "author_id": 87433, "author_profile": "https://wordpress.stackexchange.com/users/87433", "pm_score": 2, "selected": false, "text": "<p>Following Query will give you list of Post ID older than 30 days for given Category ID. </p>\n\n<pre><c...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/263953", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161/" ]
I wish to run a cron job that would permanently erase all the posts belonging to some category from the past X days (say, week). This is probably very basic, but I would appreciate some pointers. Thanks.
The first step is setting up the cron job. The second part requires querying the database for a specific post type where the entry is older than 1 week. We can do this with get\_posts() and specifying the category argument and the date\_query argument. ``` //* If the scheduled event got removed from the cron schedule...
263,970
<p>I'm having a custom post type "products" of which I need to show a list. The products are sorted by meta value into different kinds of product type. I need to set one specific product type "tools" at the bottom of the list. But it also has to be sorted by create date. So all other product types sorted by create date...
[ { "answer_id": 263960, "author": "JItendra Rana", "author_id": 87433, "author_profile": "https://wordpress.stackexchange.com/users/87433", "pm_score": 2, "selected": false, "text": "<p>Following Query will give you list of Post ID older than 30 days for given Category ID. </p>\n\n<pre><c...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/263970", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/84187/" ]
I'm having a custom post type "products" of which I need to show a list. The products are sorted by meta value into different kinds of product type. I need to set one specific product type "tools" at the bottom of the list. But it also has to be sorted by create date. So all other product types sorted by create date an...
The first step is setting up the cron job. The second part requires querying the database for a specific post type where the entry is older than 1 week. We can do this with get\_posts() and specifying the category argument and the date\_query argument. ``` //* If the scheduled event got removed from the cron schedule...
263,988
<p>I have a custom post type in WordPress with custom meta boxes.</p> <p>So I need a hierarchal post and also have a custom template set for each of the post (either Type1 or Type2).</p> <p>This is how my slug looks,</p> <p><a href="http://example.com/taxonomy/type1" rel="nofollow noreferrer">http://example.com/taxo...
[ { "answer_id": 263960, "author": "JItendra Rana", "author_id": 87433, "author_profile": "https://wordpress.stackexchange.com/users/87433", "pm_score": 2, "selected": false, "text": "<p>Following Query will give you list of Post ID older than 30 days for given Category ID. </p>\n\n<pre><c...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/263988", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/68381/" ]
I have a custom post type in WordPress with custom meta boxes. So I need a hierarchal post and also have a custom template set for each of the post (either Type1 or Type2). This is how my slug looks, <http://example.com/taxonomy/type1> - for the primary post <http://example.com/taxonomy/type1/type2> - for the secon...
The first step is setting up the cron job. The second part requires querying the database for a specific post type where the entry is older than 1 week. We can do this with get\_posts() and specifying the category argument and the date\_query argument. ``` //* If the scheduled event got removed from the cron schedule...
263,989
<p>I've restored my Wordpress database from an sql backup. However, in doing so, all of the tables have lost auto increment.</p> <p>When I try to add it back in with this sql </p> <pre><code>ALTER TABLE `mercury_posts` CHANGE `ID` `ID` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; </code></pre> <p>I get the error <co...
[ { "answer_id": 264142, "author": "SinisterBeard", "author_id": 63673, "author_profile": "https://wordpress.stackexchange.com/users/63673", "pm_score": 2, "selected": false, "text": "<p>I eventually solved this by deleting the faulty database, backing up again from the working database bu...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/263989", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/63673/" ]
I've restored my Wordpress database from an sql backup. However, in doing so, all of the tables have lost auto increment. When I try to add it back in with this sql ``` ALTER TABLE `mercury_posts` CHANGE `ID` `ID` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT; ``` I get the error `#1067 - Invalid default value for '...
The post\_date default value is 0000-00-00 00:00:00. If you check the sql\_mode variable like this: ``` show variables like 'sql_mode'; ``` ... it will show you the sql\_mode variable, that will be sth like this: **ONLY\_FULL\_GROUP\_BY,STRICT\_TRANS\_TABLES,NO\_ZERO\_IN\_DATE,NO\_ZERO\_DATE,ERROR\_FOR\_DIVISION\_B...
264,017
<p>Pretty much what the title says.</p> <p>I have a custom plugin written, that relies on the use of admin-ajax to handle various forms and actions. That's all working fine, however as the various functions echo out responses I have to throw in a die() after the echo function. ie:</p> <pre><code>echo $return_string; ...
[ { "answer_id": 264027, "author": "Mark Kaplun", "author_id": 23970, "author_profile": "https://wordpress.stackexchange.com/users/23970", "pm_score": 2, "selected": false, "text": "<p>Unfortunately, the ajax hook handler has to <code>die</code> otherwise wordpress will continue running an...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/264017", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71134/" ]
Pretty much what the title says. I have a custom plugin written, that relies on the use of admin-ajax to handle various forms and actions. That's all working fine, however as the various functions echo out responses I have to throw in a die() after the echo function. ie: ``` echo $return_string; die(); ``` All fine...
If you use `wp_die()` you can utilize the tools included with WordPress's PHPUnit test suite. The `WP_Ajax_UnitTestCase` provides the `_handleAjax()` method that will hook into the actions called by `wp_die()` and throw an exception, which will prevent `die()` from being called. I've written a [tutorial on how to use `...
264,022
<p>I found this action hook in wp-login.php file. It says it can be used to create custom actions to the wp-login. However, as I'm new to WP coding and PHP, I do not understand how {action} can work even though it is under double quotations? Here is the action hook:</p> <pre><code>do_action( "login_form_{$action}" ); ...
[ { "answer_id": 264029, "author": "birgire", "author_id": 26350, "author_profile": "https://wordpress.stackexchange.com/users/26350", "pm_score": 2, "selected": false, "text": "<p>This is a <em>dynamic</em> hook:</p>\n\n<pre><code>do_action( \"login_form_{$action}\" );\n</code></pre>\n\n<...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/264022", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112658/" ]
I found this action hook in wp-login.php file. It says it can be used to create custom actions to the wp-login. However, as I'm new to WP coding and PHP, I do not understand how {action} can work even though it is under double quotations? Here is the action hook: ``` do_action( "login_form_{$action}" ); ``` In the p...
This is a *dynamic* hook: ``` do_action( "login_form_{$action}" ); ``` Meaning that it depends on the `$action` variable. There are other such hooks used in the WordPress core. You can check out the naming convention for dynamic hooks in the *Core Contributor Handbook* [here](https://make.wordpress.org/core/handbo...
264,046
<h1>I need foo-bar to become foo/bar instead:</h1> <p>//domain.com<b>/foo-bar</b> &nbsp; &raquo; &nbsp; //domain.com<b>/foo/bar</b></p> <hr> <p>I'm rebuilding a website that is currently in a home-brew CMS. They have a few pages with children, but the parent page URL does not match the children. The parent URLs were...
[ { "answer_id": 264165, "author": "Oleg Butuzov", "author_id": 14536, "author_profile": "https://wordpress.stackexchange.com/users/14536", "pm_score": 0, "selected": false, "text": "<p>First of all, you can change rules not only with <code>add_rewrite_rule</code> but also with a filter(s)...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/264046", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103994/" ]
I need foo-bar to become foo/bar instead: ========================================= //domain.com**/foo-bar**   »   //domain.com**/foo/bar** --- I'm rebuilding a website that is currently in a home-brew CMS. They have a few pages with children, but the parent page URL does not match the children. The parent URLs were...
This rule is what I ended up with after finding this post: [Understanding add\_rewrite\_rule](https://wordpress.stackexchange.com/questions/250837/understanding-add-rewrite-rule) ``` add_rewrite_rule( '^foo/([^/]*)/?$', 'index.php?pagename=foo-$matches[1]', 'top' ); ```
264,054
<p>I want to add divs and classes to child [ li ] elements that come after [ ul class ="sub-menu" ] of the parent [ li ]. The problem is, when I try to modify the [ li ] in the start_el function, all [ li ] get modified, even the ones that are outside of the [ ul class ="sub-menu" ], the parent ones also get modified. ...
[ { "answer_id": 264059, "author": "Diogo", "author_id": 115596, "author_profile": "https://wordpress.stackexchange.com/users/115596", "pm_score": 0, "selected": false, "text": "<p>If you want to dinamically insert those <code>&lt;div&gt;</code>s based on some condition or trigger you will...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/264054", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116197/" ]
I want to add divs and classes to child [ li ] elements that come after [ ul class ="sub-menu" ] of the parent [ li ]. The problem is, when I try to modify the [ li ] in the start\_el function, all [ li ] get modified, even the ones that are outside of the [ ul class ="sub-menu" ], the parent ones also get modified. Pl...
You don't need to make a whole new walker, you can do this with just a filter and some conditionals based on the function parameters. The filter we need is `walker_nav_menu_start_el` which you can see at the bottom of your code sample. And to make sure we only target the child pages we can use the `$depth` parameter ...
264,055
<p>I´ve been struggling with this for nearly a month now and still couldn´t find anything at all on how to do this! Not here, not in Quora, not through many different advanced Google search queries...</p> <p>Here it is:</p> <p>The <strong>parent theme</strong> has only <strong>one script file</strong> <code>main.min....
[ { "answer_id": 264059, "author": "Diogo", "author_id": 115596, "author_profile": "https://wordpress.stackexchange.com/users/115596", "pm_score": 0, "selected": false, "text": "<p>If you want to dinamically insert those <code>&lt;div&gt;</code>s based on some condition or trigger you will...
2017/04/18
[ "https://wordpress.stackexchange.com/questions/264055", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115596/" ]
I´ve been struggling with this for nearly a month now and still couldn´t find anything at all on how to do this! Not here, not in Quora, not through many different advanced Google search queries... Here it is: The **parent theme** has only **one script file** `main.min.js`. It contains all the scripts and libraries b...
You don't need to make a whole new walker, you can do this with just a filter and some conditionals based on the function parameters. The filter we need is `walker_nav_menu_start_el` which you can see at the bottom of your code sample. And to make sure we only target the child pages we can use the `$depth` parameter ...
264,070
<p>Stuck in an infinite loop when trying to log in to my wordpress site. I type in the URL/wp-admin and then it loops me back to the regular website, not the admin login page. </p> <p>I have tried with http and https to no luck... </p>
[ { "answer_id": 264079, "author": "mayersdesign", "author_id": 106965, "author_profile": "https://wordpress.stackexchange.com/users/106965", "pm_score": 3, "selected": false, "text": "<p>Don't worry, you'll be back in quick if you follow these steps one at a time, until one succeeds!</p>\...
2017/04/19
[ "https://wordpress.stackexchange.com/questions/264070", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117937/" ]
Stuck in an infinite loop when trying to log in to my wordpress site. I type in the URL/wp-admin and then it loops me back to the regular website, not the admin login page. I have tried with http and https to no luck...
I found a solution. In `wp-config.php` add: ``` define('FORCE_SSL_ADMIN', false); ``` In my situation, I migrated to *https* from *http*, and use plugin *Rename wp-login.php* My `wp-config.php` contained the lines: ``` define('WP_SITEURL','https://example.com'); define('WP_HOME','https://example.com'); ``` Witho...
264,089
<p>I am learning AngularJS and wanted to created a project in AngularJS 4. In this I want to use WordPress back-end and get data through rest API. I have done little bit research but not found any useful tutorial or example. I don't want to create theme in WordPress based on AngularJS, but want independent application ...
[ { "answer_id": 264079, "author": "mayersdesign", "author_id": 106965, "author_profile": "https://wordpress.stackexchange.com/users/106965", "pm_score": 3, "selected": false, "text": "<p>Don't worry, you'll be back in quick if you follow these steps one at a time, until one succeeds!</p>\...
2017/04/19
[ "https://wordpress.stackexchange.com/questions/264089", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/94923/" ]
I am learning AngularJS and wanted to created a project in AngularJS 4. In this I want to use WordPress back-end and get data through rest API. I have done little bit research but not found any useful tutorial or example. I don't want to create theme in WordPress based on AngularJS, but want independent application in ...
I found a solution. In `wp-config.php` add: ``` define('FORCE_SSL_ADMIN', false); ``` In my situation, I migrated to *https* from *http*, and use plugin *Rename wp-login.php* My `wp-config.php` contained the lines: ``` define('WP_SITEURL','https://example.com'); define('WP_HOME','https://example.com'); ``` Witho...
264,096
<p>I've implemented some meta fields for users like mobile number, address. It can be updated by user as well as admin, I wan't to trigger an email to user and admin stating about the updated field value if any value is updated, irrespective of who updates it.</p>
[ { "answer_id": 264079, "author": "mayersdesign", "author_id": 106965, "author_profile": "https://wordpress.stackexchange.com/users/106965", "pm_score": 3, "selected": false, "text": "<p>Don't worry, you'll be back in quick if you follow these steps one at a time, until one succeeds!</p>\...
2017/04/19
[ "https://wordpress.stackexchange.com/questions/264096", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/114978/" ]
I've implemented some meta fields for users like mobile number, address. It can be updated by user as well as admin, I wan't to trigger an email to user and admin stating about the updated field value if any value is updated, irrespective of who updates it.
I found a solution. In `wp-config.php` add: ``` define('FORCE_SSL_ADMIN', false); ``` In my situation, I migrated to *https* from *http*, and use plugin *Rename wp-login.php* My `wp-config.php` contained the lines: ``` define('WP_SITEURL','https://example.com'); define('WP_HOME','https://example.com'); ``` Witho...
264,101
<p>I need to get the URL for Custom post type Thumbnail, My custom post type name is slider. I have defined on functions.php:</p> <pre><code>/* Custom post type */ add_action('init', 'slider_register'); function slider_register() { $labels = array( 'name' =&gt; __('Slider', 'post type general name'), ...
[ { "answer_id": 264108, "author": "BlueSuiter", "author_id": 92665, "author_profile": "https://wordpress.stackexchange.com/users/92665", "pm_score": 2, "selected": true, "text": "<p>Please update the while loop with this:\nIt will print the thumbnail url for you</p>\n\n<p>** POST FETCHING...
2017/04/19
[ "https://wordpress.stackexchange.com/questions/264101", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/117954/" ]
I need to get the URL for Custom post type Thumbnail, My custom post type name is slider. I have defined on functions.php: ``` /* Custom post type */ add_action('init', 'slider_register'); function slider_register() { $labels = array( 'name' => __('Slider', 'post type general name'), 'singular_na...
Please update the while loop with this: It will print the thumbnail url for you \*\* POST FETCHING ARGUMENTS \*\* ``` <?php /**** Slider Call Function ****/ function callTheSlider() { $args = array('post_type'=> 'expro_slider', 'post_status' => 'publish', 'order' => 'DESC'); ?> <ul> <?php wp_rese...
264,107
<p>Generally,</p> <p>We put <code>&lt;?php get_search_form(); ?&gt;</code> in the header where we desire the search form, and then later we put the custom code for HTML in searchform.php.</p> <p>This is the whole <a href="http://html.ankishpost.com/" rel="nofollow noreferrer">HTML</a> from where I am trying to create...
[ { "answer_id": 264155, "author": "ciaika", "author_id": 48497, "author_profile": "https://wordpress.stackexchange.com/users/48497", "pm_score": 0, "selected": false, "text": "<p>Try this form based on your code:</p>\n\n<pre>&lt;form action=\"&lt;?php echo esc_url(home_url()); ?>\" method...
2017/04/19
[ "https://wordpress.stackexchange.com/questions/264107", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/105791/" ]
Generally, We put `<?php get_search_form(); ?>` in the header where we desire the search form, and then later we put the custom code for HTML in searchform.php. This is the whole [HTML](http://html.ankishpost.com/) from where I am trying to create an HTML template. This is the Portion of an HTML ``` <li><input clas...
Below you can find a template for displaying Search Results pages. Add the code to your **search.php** file. If you have installed the **WP-PageNavi** plugin then you'll see the pagination if the search result has more than 10 items. ``` <?php /** * The template for displaying Search Results pages. */ get_header(); ?...
264,115
<p>I'm using the following JS code to open a wp.media window to allow users to select images and videos for a gallery. Everything is working as expected, but I'm unable to restrict the window to show images and videos only, it's showing everything.</p> <p>Any ideas on what might be wrong? </p> <p>Thanks in advance</p...
[ { "answer_id": 268597, "author": "user433351", "author_id": 83792, "author_profile": "https://wordpress.stackexchange.com/users/83792", "pm_score": 5, "selected": true, "text": "<p>It's been a while since this question was asked, but on the off chance that you are still looking for a sol...
2017/04/19
[ "https://wordpress.stackexchange.com/questions/264115", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/33049/" ]
I'm using the following JS code to open a wp.media window to allow users to select images and videos for a gallery. Everything is working as expected, but I'm unable to restrict the window to show images and videos only, it's showing everything. Any ideas on what might be wrong? Thanks in advance **JS:** ``` $( '#...
It's been a while since this question was asked, but on the off chance that you are still looking for a solution: ``` items_frame = wp.media.frames.items = wp.media({ title: 'Add to Gallery', button: { text: 'Select' }, library: { type: [ 'video', 'image' ] }, }); ```
264,156
<p>I am using the following code to show the expiration date of my coupon;</p> <pre><code> &lt;?php _e('Expiration Date:','wpestate'); echo esc_html($expiration_date); ?&gt; </code></pre> <p>But, it is showing in following unreadable format; </p> <blockquote> <p>Expiration Date:1491955200</p> </blockquote> <p>Th...
[ { "answer_id": 268597, "author": "user433351", "author_id": 83792, "author_profile": "https://wordpress.stackexchange.com/users/83792", "pm_score": 5, "selected": true, "text": "<p>It's been a while since this question was asked, but on the off chance that you are still looking for a sol...
2017/04/19
[ "https://wordpress.stackexchange.com/questions/264156", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/93692/" ]
I am using the following code to show the expiration date of my coupon; ``` <?php _e('Expiration Date:','wpestate'); echo esc_html($expiration_date); ?> ``` But, it is showing in following unreadable format; > > Expiration Date:1491955200 > > > Therefore how to convert it to readable format like; > > Expi...
It's been a while since this question was asked, but on the off chance that you are still looking for a solution: ``` items_frame = wp.media.frames.items = wp.media({ title: 'Add to Gallery', button: { text: 'Select' }, library: { type: [ 'video', 'image' ] }, }); ```
264,179
<p>I used the XML Sitemaps in the All in One SEO Pack plugin to generate my sitemap.</p> <p>When I type in the site address/sitemap.xml (<a href="http://flysuas.ie/sitemap.xml" rel="nofollow noreferrer">http://flysuas.ie/sitemap.xml</a>) the sitemap appears.</p> <p>I want to get rid of some links that don't make sens...
[ { "answer_id": 264180, "author": "Oleg Butuzov", "author_id": 14536, "author_profile": "https://wordpress.stackexchange.com/users/14536", "pm_score": 1, "selected": false, "text": "<p>hm.. isn't you suppose to run find command in other way?</p>\n\n<pre><code>sudo find / -iname sitemap*\n...
2017/04/19
[ "https://wordpress.stackexchange.com/questions/264179", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/71456/" ]
I used the XML Sitemaps in the All in One SEO Pack plugin to generate my sitemap. When I type in the site address/sitemap.xml (<http://flysuas.ie/sitemap.xml>) the sitemap appears. I want to get rid of some links that don't make sense but when I look for sitemap.xml on the machine it is not present. ``` sudo find -n...
The sitemap added by most of the plugins (such as Google sitemaps or YOAST SEO pack) is a virtual file added to your websites by the plugin. This file doesn't physically exist, therefore modifying it is not an option for you. There might be 2 things that you can do about it, Either find the `php` file that is generat...
264,186
<p>I have loop and I want to get the amount of posts on a current page. So I try:</p> <pre><code>&lt;?php $post_number = $wp_query-&gt;post_count; ?&gt; &lt;?php echo($post_number) ; ?&gt; &lt;?php while ( have_posts() ) : the_post();?&gt; &lt;?php get_template_part( 'post', get_post_format() );?&gt; &lt;?php endw...
[ { "answer_id": 264180, "author": "Oleg Butuzov", "author_id": 14536, "author_profile": "https://wordpress.stackexchange.com/users/14536", "pm_score": 1, "selected": false, "text": "<p>hm.. isn't you suppose to run find command in other way?</p>\n\n<pre><code>sudo find / -iname sitemap*\n...
2017/04/19
[ "https://wordpress.stackexchange.com/questions/264186", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116307/" ]
I have loop and I want to get the amount of posts on a current page. So I try: ``` <?php $post_number = $wp_query->post_count; ?> <?php echo($post_number) ; ?> <?php while ( have_posts() ) : the_post();?> <?php get_template_part( 'post', get_post_format() );?> <?php endwhile; ?> ``` but it doesn't work. I can't ...
The sitemap added by most of the plugins (such as Google sitemaps or YOAST SEO pack) is a virtual file added to your websites by the plugin. This file doesn't physically exist, therefore modifying it is not an option for you. There might be 2 things that you can do about it, Either find the `php` file that is generat...
264,233
<p>I'm developing a website with 3 different post types, and 4 different taxonomies to save the posts under.</p> <p>The default post type and categories are unused in this template, and since many of authors are not very familiar with WordPress and we can't always control them, i wish to delete, change or at least hid...
[ { "answer_id": 264234, "author": "Thijs", "author_id": 107050, "author_profile": "https://wordpress.stackexchange.com/users/107050", "pm_score": 4, "selected": true, "text": "<p>Yes this is possible with a very simple solution. Add this code snippet to your theme's funtion.php</p>\n\n<pr...
2017/04/20
[ "https://wordpress.stackexchange.com/questions/264233", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/94498/" ]
I'm developing a website with 3 different post types, and 4 different taxonomies to save the posts under. The default post type and categories are unused in this template, and since many of authors are not very familiar with WordPress and we can't always control them, i wish to delete, change or at least hide the cate...
Yes this is possible with a very simple solution. Add this code snippet to your theme's funtion.php ``` add_action('admin_menu','remove_default_post_type'); function remove_default_post_type() { remove_menu_page('edit.php'); } ``` More info: <https://www.techjunkie.com/remove-default-post-type-from-admin-menu-w...
264,235
<p>I am new to wordpress and I am creating a theme for a local company as my final project towards my college degree. They wish to use this theme as a main theme for all their wp sites and that any change in design shall be taken care of by child themes. </p> <p>they requested that some subpages should have a sidebar ...
[ { "answer_id": 264260, "author": "CompactCode", "author_id": 118063, "author_profile": "https://wordpress.stackexchange.com/users/118063", "pm_score": 3, "selected": true, "text": "<p>Maybe this helps :</p>\n\n<pre><code>function get_all_wordpress_menus(){\n return get_terms( 'nav_men...
2017/04/20
[ "https://wordpress.stackexchange.com/questions/264235", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/118049/" ]
I am new to wordpress and I am creating a theme for a local company as my final project towards my college degree. They wish to use this theme as a main theme for all their wp sites and that any change in design shall be taken care of by child themes. they requested that some subpages should have a sidebar menu and s...
Maybe this helps : ``` function get_all_wordpress_menus(){ return get_terms( 'nav_menu', array( 'hide_empty' => true ) ); } ``` get\_registered\_nav\_menus only gets the theme's menu's and not the clients menu's. Source : [Paulund](https://paulund.co.uk/get-all-wordpress-navigation-menus) This returns all ID's...
264,238
<p>I have a category called News and a custom Taxonomy called Filters which is a hierarchical Taxonomy.</p> <p>When a user creates a Post, they select a subcategory under news and a sub-filter under the Filter Taxonomy.</p> <p>Now I am trying to list all the 'Sub-Categories' and 'Filters' when a user navigates to /ne...
[ { "answer_id": 264261, "author": "Nate", "author_id": 87380, "author_profile": "https://wordpress.stackexchange.com/users/87380", "pm_score": 1, "selected": false, "text": "<p>I'm not sure that I've understand what you are asking for but i hope this can help you out-</p>\n\n<p><strong>Ge...
2017/04/20
[ "https://wordpress.stackexchange.com/questions/264238", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/114495/" ]
I have a category called News and a custom Taxonomy called Filters which is a hierarchical Taxonomy. When a user creates a Post, they select a subcategory under news and a sub-filter under the Filter Taxonomy. Now I am trying to list all the 'Sub-Categories' and 'Filters' when a user navigates to /news. Listing the ...
The following code will do it. Please change the 'filter' text in the below code to whatever filters taxonomy name you have set. ``` if(is_category() ){ $thiscat = get_queried_object_id(); $filter_tax = array(); $args = array( 'category' => $thiscat ); $lastposts = get_posts( $args ); foreach ( ...
264,284
<p>I created a custom content template, assigned it to a page and coded the query.</p> <p>Everything appears to be working as they should. The only issue I have is with the pagination. So, when I go the second page I get a "No posts were found."</p> <p>What I've tried so far:</p> <ul> <li>I set another paginated gri...
[ { "answer_id": 264700, "author": "BlueSuiter", "author_id": 92665, "author_profile": "https://wordpress.stackexchange.com/users/92665", "pm_score": 3, "selected": true, "text": "<p>Please, update your loop part with following code:</p>\n\n<pre><code>&lt;?php\n\n$page = (get_query_var('pa...
2017/04/20
[ "https://wordpress.stackexchange.com/questions/264284", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115305/" ]
I created a custom content template, assigned it to a page and coded the query. Everything appears to be working as they should. The only issue I have is with the pagination. So, when I go the second page I get a "No posts were found." What I've tried so far: * I set another paginated grid (3rd party plugin) as a ho...
Please, update your loop part with following code: ``` <?php $page = (get_query_var('page') ? get_query_var('page') : 1); $args=array('post_type' => 'gadget', 'post_status' => 'publish', 'posts_per_page' => 36, 'page' => $page); $wp_query = new WP_Query($args); if( $wp_query->have_posts() ) { $i = 0; while ...
264,289
<p>The Twenty Seventeen header displays two text boxes: the Site Title and the Tagline. I would like to add a new text box at the top right of the screen. How can I do it?</p> <p>I have an active Twenty Seventeen child theme.</p>
[ { "answer_id": 264324, "author": "Greeso", "author_id": 34253, "author_profile": "https://wordpress.stackexchange.com/users/34253", "pm_score": 1, "selected": false, "text": "<p>In the original Twenty Seventeen theme, find which file is used to display the Site Title and the Tagline. The...
2017/04/20
[ "https://wordpress.stackexchange.com/questions/264289", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112370/" ]
The Twenty Seventeen header displays two text boxes: the Site Title and the Tagline. I would like to add a new text box at the top right of the screen. How can I do it? I have an active Twenty Seventeen child theme.
That works if you put your code in header.php, copied in the childtheme, after the line: ``` <header id="masthead" class="site-header" role="banner"> ``` My html code is: ``` <div class="logo-right-text"> <span style="font-size: 14px; font-weight: bold; color: #555;">1800-123-456-22</span> <div class="clear" style=...
264,313
<p>I've been working on my own theme and for some reason wordpress doesn't seem to be implementing my code. My navigation bar doesn't load right if I'm logged in but loads find if I'm logged out, however any bootstrap coding I put in the body loads right if I'm logged in but doesn't load if I'm logged out.</p> <p>When...
[ { "answer_id": 264324, "author": "Greeso", "author_id": 34253, "author_profile": "https://wordpress.stackexchange.com/users/34253", "pm_score": 1, "selected": false, "text": "<p>In the original Twenty Seventeen theme, find which file is used to display the Site Title and the Tagline. The...
2017/04/20
[ "https://wordpress.stackexchange.com/questions/264313", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/90816/" ]
I've been working on my own theme and for some reason wordpress doesn't seem to be implementing my code. My navigation bar doesn't load right if I'm logged in but loads find if I'm logged out, however any bootstrap coding I put in the body loads right if I'm logged in but doesn't load if I'm logged out. When I'm logge...
That works if you put your code in header.php, copied in the childtheme, after the line: ``` <header id="masthead" class="site-header" role="banner"> ``` My html code is: ``` <div class="logo-right-text"> <span style="font-size: 14px; font-weight: bold; color: #555;">1800-123-456-22</span> <div class="clear" style=...
264,328
<p>After updating to Woocommerce 3.0, in the Woocommerce ORDER page (where you can check all the orders made by customers, with order status, billing address, shipping address, total, etc.) is missing the column with the items purchased by the customer. Before WC update, that column was there. Now it is gone.</p> <p>C...
[ { "answer_id": 264329, "author": "Sender", "author_id": 118103, "author_profile": "https://wordpress.stackexchange.com/users/118103", "pm_score": 1, "selected": false, "text": "<p>I have already manage to create a column thanks to this:</p>\n\n<pre><code> // ADDING COLUMN TITLES\nadd_...
2017/04/20
[ "https://wordpress.stackexchange.com/questions/264328", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/118103/" ]
After updating to Woocommerce 3.0, in the Woocommerce ORDER page (where you can check all the orders made by customers, with order status, billing address, shipping address, total, etc.) is missing the column with the items purchased by the customer. Before WC update, that column was there. Now it is gone. Could anyon...
I have already manage to create a column thanks to this: ``` // ADDING COLUMN TITLES add_filter( 'manage_edit-shop_order_columns', 'custom_shop_order_column',11); function custom_shop_order_column($columns) { //add columns $columns['my-column1'] = __( 'Column Title','theme_slug'); return $columns; } // ...
264,338
<p>I'm trying to alter a plugin with this line:</p> <pre><code>wp_enqueue_script($this-&gt;_token . '-admin', esc_url($this-&gt;assets_url) . 'js/admin' . $this-&gt;script_suffix . '.js, $scripts, $this-&gt;_version); </code></pre> <p>When I print $this->_version it comes up as '3.0.0' but when the admin.js is printe...
[ { "answer_id": 264329, "author": "Sender", "author_id": 118103, "author_profile": "https://wordpress.stackexchange.com/users/118103", "pm_score": 1, "selected": false, "text": "<p>I have already manage to create a column thanks to this:</p>\n\n<pre><code> // ADDING COLUMN TITLES\nadd_...
2017/04/21
[ "https://wordpress.stackexchange.com/questions/264338", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116224/" ]
I'm trying to alter a plugin with this line: ``` wp_enqueue_script($this->_token . '-admin', esc_url($this->assets_url) . 'js/admin' . $this->script_suffix . '.js, $scripts, $this->_version); ``` When I print $this->\_version it comes up as '3.0.0' but when the admin.js is printed it comes along as ``` <script type...
I have already manage to create a column thanks to this: ``` // ADDING COLUMN TITLES add_filter( 'manage_edit-shop_order_columns', 'custom_shop_order_column',11); function custom_shop_order_column($columns) { //add columns $columns['my-column1'] = __( 'Column Title','theme_slug'); return $columns; } // ...
264,340
<p>In my most recent project, I'm dealing with a website that included dozens of custom taxonomies, couple of post types, content, etc. and required different templates for different authors or tags.</p> <p>Right now, my template folder has about 70 php files for templates, which is really confusing. </p> <p>I notice...
[ { "answer_id": 264342, "author": "Dave Romsey", "author_id": 2807, "author_profile": "https://wordpress.stackexchange.com/users/2807", "pm_score": 3, "selected": true, "text": "<p>Page templates can be stored within the <code>page-templates</code> or <code>templates</code> subdirectory w...
2017/04/21
[ "https://wordpress.stackexchange.com/questions/264340", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/94498/" ]
In my most recent project, I'm dealing with a website that included dozens of custom taxonomies, couple of post types, content, etc. and required different templates for different authors or tags. Right now, my template folder has about 70 php files for templates, which is really confusing. I noticed that some theme...
Page templates can be stored within the `page-templates` or `templates` subdirectory within a theme, but this does not apply to custom post type or taxonomy templates. Fortunately, the `template_include` filter can be used to change the template that will be loaded. In the example below, template files are stored in t...
264,346
<p>I've uploaded several images to my blog posts. I didn't cared about their size so I've put there even 5mb images which could be easily compressed for 200kb. I know that wordpress already processed them, cutted and customized, but now I'm worried as my whole blog is very big. </p> <p>I would like to delete original...
[ { "answer_id": 264342, "author": "Dave Romsey", "author_id": 2807, "author_profile": "https://wordpress.stackexchange.com/users/2807", "pm_score": 3, "selected": true, "text": "<p>Page templates can be stored within the <code>page-templates</code> or <code>templates</code> subdirectory w...
2017/04/21
[ "https://wordpress.stackexchange.com/questions/264346", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/111175/" ]
I've uploaded several images to my blog posts. I didn't cared about their size so I've put there even 5mb images which could be easily compressed for 200kb. I know that wordpress already processed them, cutted and customized, but now I'm worried as my whole blog is very big. I would like to delete originals or at le...
Page templates can be stored within the `page-templates` or `templates` subdirectory within a theme, but this does not apply to custom post type or taxonomy templates. Fortunately, the `template_include` filter can be used to change the template that will be loaded. In the example below, template files are stored in t...
264,355
<p>I am using Enough theme and i want to create a child theme the way suggested in codex i.e. using wp_enqueue_style. I am doing it the way it's explained but left margin more now like it's indented to right. Seems to me some stylesheet loading problem. </p> <p>I have created style.css and functions.php in child theme...
[ { "answer_id": 264361, "author": "sorrow poetry", "author_id": 106011, "author_profile": "https://wordpress.stackexchange.com/users/106011", "pm_score": 1, "selected": false, "text": "<p>about styles you need to specify a name for each style the cant be the same and its necessary if you ...
2017/04/21
[ "https://wordpress.stackexchange.com/questions/264355", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/118115/" ]
I am using Enough theme and i want to create a child theme the way suggested in codex i.e. using wp\_enqueue\_style. I am doing it the way it's explained but left margin more now like it's indented to right. Seems to me some stylesheet loading problem. I have created style.css and functions.php in child theme folder....
It is very best described in the WordPress [Child theme codex](https://codex.wordpress.org/Child_Themes) page. Basically to load child theme and parent theme stylesheet files, you have to just add following code in the functions.php file of your child theme. ``` function my_theme_enqueue_styles() { $parent_style...
264,363
<p>What's the best way to set the <code>required</code> atribute on html forms in wordpress, for instance I would like post-content to be required, so this code need to be changed:</p> <pre><code>&lt;textarea class="wp-editor-area" style="height: 300px; margin-top: 37px;" autocomplete="off" cols="40" name="content" id...
[ { "answer_id": 264399, "author": "JItendra Rana", "author_id": 87433, "author_profile": "https://wordpress.stackexchange.com/users/87433", "pm_score": 2, "selected": false, "text": "<p>Don't rely entirely on JavaScript validations. Use below hook for Server side validation. </p>\n\n<pre>...
2017/04/21
[ "https://wordpress.stackexchange.com/questions/264363", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116259/" ]
What's the best way to set the `required` atribute on html forms in wordpress, for instance I would like post-content to be required, so this code need to be changed: ``` <textarea class="wp-editor-area" style="height: 300px; margin-top: 37px;" autocomplete="off" cols="40" name="content" id="content"></textarea> ``` ...
Finally I have solved it as follows: ``` add_action( 'admin_enqueue_scripts', array($this, 'my_admin_scripts') ); function my_admin_scripts($page) { global $post; if ($page == "post-new.php" OR $page == "post.php") { wp_register_script( 'my-custom-admin-scripts', plugins_url('/js/my-admin-post.js',di...
264,366
<p>I'm facing a serious problem , I have to get some posts from wordpress website to my ionic app , so I activated the json api for wordpress but when I try to get specefic posts I can't find them in the json file. this is the website <a href="http://www.jneyne.com" rel="nofollow noreferrer">http://www.jneyne.com</a> a...
[ { "answer_id": 264399, "author": "JItendra Rana", "author_id": 87433, "author_profile": "https://wordpress.stackexchange.com/users/87433", "pm_score": 2, "selected": false, "text": "<p>Don't rely entirely on JavaScript validations. Use below hook for Server side validation. </p>\n\n<pre>...
2017/04/21
[ "https://wordpress.stackexchange.com/questions/264366", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/118128/" ]
I'm facing a serious problem , I have to get some posts from wordpress website to my ionic app , so I activated the json api for wordpress but when I try to get specefic posts I can't find them in the json file. this is the website <http://www.jneyne.com> and those are the posts(Dar Boumakhlouf,Dar Gaïa...) <http://www...
Finally I have solved it as follows: ``` add_action( 'admin_enqueue_scripts', array($this, 'my_admin_scripts') ); function my_admin_scripts($page) { global $post; if ($page == "post-new.php" OR $page == "post.php") { wp_register_script( 'my-custom-admin-scripts', plugins_url('/js/my-admin-post.js',di...
264,398
<p>I'm trying to improve my learning WordPress is very new, and the first theme. My problem is,</p> <p><strong>With the function "wp_nav_menu" into the "ul" tag,</strong></p> <pre><code>data-hover = "dropdown" data-animations = "zoomIn zoomIn zoomIn zoomIn" </code></pre> <p><strong>I want to add html attributes, how...
[ { "answer_id": 264400, "author": "MagniGeeks Technologies", "author_id": 116950, "author_profile": "https://wordpress.stackexchange.com/users/116950", "pm_score": 1, "selected": true, "text": "<p><a href=\"https://developer.wordpress.org/reference/functions/wp_nav_menu/\" rel=\"nofollow ...
2017/04/21
[ "https://wordpress.stackexchange.com/questions/264398", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/118135/" ]
I'm trying to improve my learning WordPress is very new, and the first theme. My problem is, **With the function "wp\_nav\_menu" into the "ul" tag,** ``` data-hover = "dropdown" data-animations = "zoomIn zoomIn zoomIn zoomIn" ``` **I want to add html attributes, how can I do that ?,** My aim is to make a hover dro...
[wp\_nav\_menu](https://developer.wordpress.org/reference/functions/wp_nav_menu/) has all the documentation written there. You just need to put "ul" in the parameter "container". So your modified function call will be, ``` wp_nav_menu( array( 'theme_location' => 'main-menu', 'container => 'ul', 'containe...
264,407
<p>I'm developing a plugin, with a login system.</p> <p>I need to conditionally remove a menu entry from a nav menu on the frontend, if <code>$_SESSION['member-user']</code> is set.</p> <p>For example, I want a 'register' link to only appear if <code>$_SESSION['member-user']</code> is not set</p> <p>I did try to sea...
[ { "answer_id": 264411, "author": "joetek", "author_id": 62298, "author_profile": "https://wordpress.stackexchange.com/users/62298", "pm_score": 0, "selected": false, "text": "<p>You can just wrap the output in your plugin with a conditional like this:</p>\n\n<pre><code>&lt;ul&gt;\n &lt;...
2017/04/21
[ "https://wordpress.stackexchange.com/questions/264407", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115372/" ]
I'm developing a plugin, with a login system. I need to conditionally remove a menu entry from a nav menu on the frontend, if `$_SESSION['member-user']` is set. For example, I want a 'register' link to only appear if `$_SESSION['member-user']` is not set I did try to search in codex without success. Thank you! EDIT...
you can write like below for WordPress : ``` <?php if ( !is_user_logged_in() ) { ?> <ul> <li><a href="login">Login</a></li> <li><a href="register">Register</a></li> </ul> <?php } ```
264,415
<p>Seems like a simple problem but I'm having issues dealing with it.</p> <p>Here's the layout I need</p> <p><strong>loop one</strong></p> <p>Feature </p> <p><strong>loop two</strong></p> <p>Secondary</p> <p>tert - tert - tert</p> <p>Secondary</p> <p>tert - tert - tert</p> <p>Secondary</p> <p>etc</p> <p>Easy...
[ { "answer_id": 264417, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 2, "selected": false, "text": "<p>You could use 3 separate loops, and break out of each loop early once you've got enough posts.</p>\n\n<p>For...
2017/04/21
[ "https://wordpress.stackexchange.com/questions/264415", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103782/" ]
Seems like a simple problem but I'm having issues dealing with it. Here's the layout I need **loop one** Feature **loop two** Secondary tert - tert - tert Secondary tert - tert - tert Secondary etc Easy enough to do feature as a separate loop. But I want to repeat the 1 col (secondary) 3 (tert) col layout. ...
You could use 3 separate loops, and break out of each loop early once you've got enough posts. For example, here is a 2 column grid with a single query: ``` $q = new WP_Query( ... ); if ( $q->have_posts() ) { ?> <div class="columns"> <div> <?php $counter = 0; while...