WordPress Plugin Development – get_option error

I am trying to put the option on selected with the built in function of wordpress called selected. I have tried to change the key from opt to different key names for every select field and it still didn’t work.

At the moment i am stuck, see my code below:

$  taxonomy_args = array(     'public'    =>  true,     '_builtin'  =>  false );  $  taxonomy_names = get_taxonomies($  taxonomy_args);  $  select_field = get_option('select_field');   echo "<form id='example_details' method='post' action''>";     foreach( $  taxonomy_names as $  taxonomy_name ) {         echo "<div class='div_fields'>";         $  taxonomy_name_lc = strtolower($  taxonomy_name);         echo "<label for='$  {taxonomy_name_lc}_select_field'>$  {taxonomy_name}</label>";             echo "<select class='example_form_select' name='details_select_field[opt]' id='$  {taxonomy_name_lc}_select_field'>";                 echo "<option></option>";                 $  terms = get_terms( array(                      'hide_empty'    => false,                     'taxonomy'      => $  taxonomy_name                 ) );                                  foreach ($  terms as $  term) {                     echo "<option id='" . $  term->name . "' value='" . $  term->name . "' " . selected(isset($  select_field['opt']), $  term->name) . ">" . $  term->name . "</option>";                 }               echo "</select>";         echo "</div>";     }     wp_nonce_field( $  this->plugin, 'details_nonce' ); echo "</form>";  

I did a var_dump on the $ select_field variable but that one returns a boolean of false.

How to get the to work in a custom Gutenberg plugin?

I am trying to develop a new Gutenberg plugin which will need to save raw html . I use the utility in the save method and it seems to be outputting nothing. Then I output the sampe attribute within a simple and I can see that it does output the escaped html. In my usecase, I need to ensure the the RawHTML is saved. How do I accompish this.

Here the the code: It is very elementary. There is a textarea and I paste the HTML into it. Then when the save is called, I use {props.attributes.content} to persist. I have added a simple span just to make sure that the content was not blank. In the published post, I see the simple span but where I expect Rawhtml, it is blank

What is going on ? How can I make RawHTML work for my plugin code ?

(I am testing with WordPress Version 5.4.2 )

import block_icons from '../icons/index';  //  Import CSS. import './style.scss'; import './editor.scss';   const { RawHTML } = wp.element; const { PanelBody, PanelRow,     TextControl, SelectControl, Disabled, SandBox, SVG, Path } = wp.components   const { InspectorControls,     BlockControls,     AlignmentToolbar,     RichText,     BlockAlignmentToolbar, PlainText } = wp.editor;  const { withState } = wp.compose; const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks   registerBlockType('poc/sandbx', {     title: __('TestRaw', 'poc'),     description: __('TestRaw example', 'poc'),     category:  'common',     icon: block_icons.vipu,      attributes: {         content: {             type: 'string',             default: ''         },     },      supports: {         html: false,     },        edit: (props) => {         console.log(props);         console.log("content :" + props.attributes.content);          return [             <div className={props.className}>                   <textarea className="block-editor-plain-text"                       placeholder={__('Add your html  here.', 'poc')}                      onChange={(event) => props.setAttributes({ content: event.target.value })}                      value={props.attributes.content}                 />                </div>         ];     },     save: (props) => {         return (<div className="wp-content-block">             <span className="check1">                 <RawHTML> {props.attributes.content} </RawHTML>             </span>              // double check to ensure that the content was not blank.             <span className="check2">                 {props.attributes.content}             </span>          </div>         )        } }); 

Can’t reset tax query using ajax sorting plugin?

I have created an ajax sorting feature that filters a custom post type "Music" and its all separated by Genres and Tags.. the sorting works fine until.. I deselect all options. I’ve tried to add "all" as the default and added in the JS that if the genre is "all" to include all the posts. Every thing else works as desired but I need to be able to reset the tax query or include all.

Here is that javascript:

jQuery(document).ready(function($  ){                var bgenre = $  (":checkbox[name=bgenre]");     var btags = $  (":checkbox[name=btags]");          jQuery.merge( bgenre, btags ).on( "change", function() {              var genre;     var tags;            var genrearray = [];         var tagsarray = [];                           $  (":checkbox[name=bgenre]:checked").each(function() {              genrearray.push($  (this).val());                          //genre = genrearray.join();                 genre = genrearray;                  });                          $  (":checkbox[name=btags]:checked").each(function() {              tagsarray.push($  (this).val());              tags = tagsarray.join();                     });              //  var tags = tagsarray.join();          if (genrearray.length < 1) {         genre = 'all';     }          data = {             'action': 'filterlist',             'genre': genre,             'tags': tags                      };           $  .ajax({             url : ajaxurl,             data : data,             type : 'POST',             beforeSend : function ( xhr ) {                  $  ('.bplaylist').html( 'Loading...' );                 $  ('.js-Genre').attr( 'disabled', 'disabled' );                              },             success : function( data ) {                 if ( data ) {                                                        $  ('.bplaylist').html( data.posts );                       $  ('.js-Genre').removeAttr('disabled');                     $  ( '.js-Tags' ).removeAttr('disabled');                                      } else {                     $  ('.bplaylist').html( 'No posts found.' );                 }             }         });     })     }); 

and here is the php

function ajax_filterlist_handler() {                       //$  tags = esc_attr( $  _POST['tags'] );            $  genre = $  _POST['genre'];             $  tags = $  _POST['tags'];                                $  args = array(             'post_type' => 'download',             'post_status' => 'publish',             'posts_per_page' => -1,             'orderby' => 'date',             'order' => 'DESC',             'tax_query' => array(),             'relation' => IN         );                        if ( isset( $  _POST['genre']) && $  _POST['genre'] !== 'all'   ) {         $  args['tax_query'][] = array(             'taxonomy' => 'genre',             'field' => 'slug',             'terms' => $  genre          ); }           if ( isset( $  _POST['genre']) && $  _POST['genre'] === 'all'   ) {          $  args['tax_query'][] = array(             'taxonomy' => 'genre'                                         );                  }     if ( !isset( $  _POST['genre']) ) {          $  args['tax_query'][] = array(              );                  }                        if( isset( $  _POST['tags'] ) ) {         $  args['tax_query'][] = array(             'taxonomy' => 'download_tag',             'field' => 'slug',             'terms' => $  tags         );     }                 $  posts = 'No Posts Available';          $  the_query = new WP_Query( $  args );               if ( $  the_query->have_posts() ) :             ob_start();              while ( $  the_query->have_posts() ) : $  the_query->the_post();             get_template_part( '/custom/template-parts/trackitem' );             endwhile;              $  posts = ob_get_clean();         endif;          $  return = array(             'posts' => $  posts         );          wp_send_json($  return);     }     add_action( 'wp_ajax_filterlist', 'ajax_filterlist_handler' );     add_action( 'wp_ajax_nopriv_filterlist', 'ajax_filterlist_handler' );    

Sorry if the code is jumbled mess at this point. I was following a tutorial and after I got it working. I kinda went on my own to try to figure out the reset and/or all option.

Is there a tool to see every WordPress site that’s using a particular plugin?

Is there a tool to see every WordPress site that’s using a particular plugin? For example: if I wanted to know every website in the world that is currently (or historically) using Yoast SEO.

I realize this would probably be a third party tool, so I don’t know if it’s appropriate for this forum. But, I figured it’s a good place to ask seeing as it’s related to WordPress.

Using the Mailchimp plugin for woocommerce, How do I tag/segment by user type?

I am using Woocommerce Mailchimp and I also have multiple user types or roles. I want to be able to tag/segment by user type/role so I can send different marketing material to different user types.

Right now I am using the Dokan Marketplace plugin which gives me a second user type called vendor (as well as the standard Customer). I would like to be able to address each user type differently as customers shouldn’t receive vendor style updates.

How can I accomplish this?

WordPress Plugin to display a list of input fields which are visible to everyone?

I am looking for a plugin/workaround recommendations. I am sorry if the title was not descriptive enough, this is the best I could think of. Any edit suggestion is welcome.

I want to display a list of editable text fields, which are updated by any visitor, and all updates are live and public to everyone else. The submitted fields may or may not be editable anymore.

So, once a visitor visits the page, there will be a list of empty blanks/fields, short text fields for instance. They will fill in their name and their details, then submit. All other visitors will see that this field is taken/filled.

The reason is that there will be a list of offerings, and the link will be distributed among participants only, each participant can fill a “slot” with their details after seeing which slots are available.

I don’t need any extra validation or complexity. Logging in is not required.

  • Preferably free, reasonably paid solutions are accepted, too.

How to translate Facebook Messenger Chat Plugin on site via Google Tag Manager

i’ve been using this tip in order to add Facebook Messenger Chat Plugin on a website via Google Tag Manager, and it’s working (many thanks !) How to add the Facebook Messenger Customer Chat Plugin to your site using Google Tag Manager

but : when the visitor is not connected to his FB account, the welcome phrase is in english. The other translations managed through the FB app are working correctly when you are connected to FB.

i’m really not into code, but i changed this : js.src = “https://connect.facebook.net/**en_US/sdk.js”;enter image description here into that : js.src = “https://connect.facebook.net/fr_FR/sdk.js”; with no effect.

do you have a solution ?

have a nice day, A.

Conditionally check if page is using template from plugin directory

I am having trouble loading the script conditionally in my plugin.

I have a DataTables page and want to load datatables scripts only for that page. So I made a page template called datatables-template.php and loading dynamically so can set the template in page attribute.

The template path is my-plugin/public/templates/datatables-template.php

So far so all is working fine. However, when I try to load script explicit fore that template using is_page_template()

When I have checked with get_page_template() that returning theme current page template which is page.php in my case.

Note: is_page working fine, of course, since it will check the current page, that would work. I have also checked my path using file_exists and that returns true. That means I am giving a correct path for the template. So no idea how to check it.

Additionally: I have tried with global $ template which returns the correct plugin template but that doesn’t work in conditional check in my plugin file.

global $  template;  if('datatables-template.php' == $  template){     //load script } 

Question: How can I check if the page has set the specific page template in page attributes, in my case datatables-template.php and load script explicit for that page?

★★★★★ Kill Your Bounce Rate With Zero Bounce WordPress Plugin ★★★★★

Get More Traffic and Make More Sales
By Killing Your Bounce Rate With
Zero Bounce WordPress Plugin

image

Picture this: You have your website set up, you’ve fine-tuned your sales funnel, and you’re landing page is primed for maximum conversions. All you need now is to pour in some traffic and start making money online.
What could possibly go wrong…?

BOUNCE RATE!

Bounce rate is when visitors land on your website only to immediately click the back button on their browser. This is typically a website’s most devastating loss of traffic!
According to recent studies the average bounce rate for websites is 50% to 70% !

That’s potentially 50% to 70% of your profits going down the drain!

ZERO BOUNCE WordPress Plugin

Brought to you by Force Spark, ZERO BOUNCE is a true next generation bounce rate reduction plugin for the WordPress website platform.

By allowing you to redirect your visitors to any URL of your choice when they click the back button,
it allows you to virtually eliminate your bounce rate and turn “lost” traffic into profit!

Website without ZERO BOUNCE WP Plugin:

image

Website with ZERO BOUNCE WP Plugin:

image

List of all features and demo video are available at product website:
ForceSpark.net

ZERO BOUNCE is Easy to Use and Beginner Friendly!
Get Setup and Kill Your Bounce Rate in Less than 1 Minute!

Get Instant Access to ZERO BOUNCE
>> Visit ForceSpark.net <<

Special Discount for GSA members: 15% OFF Regular Price
Simply post “Give me 15% OFF Discount Coupon” in this thread
and I will send you PM with discount code.

For All Support Questions – Visit Support Desk Here

Affiliates – Visit Affiliate Program Page Here

image

Plugin Options:

Manual On/Off Switch
This plugin comes with an easy to use “on/off” switch. This gives you complete control when using this plugin and keeps you from having to uninstall the plugin if you want to temporarily disable it.

Easy to Use URL Redirect
Don’t lose money because people are hitting the back button! Redirect your “lost” traffic to any URL you wish and increase your conversions and revenue with ease!

Dynamic Redirect Rotation
ZERO BOUNCE allows you to automatically rotate several redirect URLs. This is exceptional for split testing so that you can ensure that you always get the highest conversion rates possible!

Selective Redirect
Want to only redirect visitors who come from certain sites? Thanks to ZERO BOUNCE’s advanced “string” technology you can set it to redirect only visitors who come from sites you specify!

Automatic Timed Deactivation
There may be instances where you’d want ZERO BOUNCE to turn off and not redirect visitors if they’ve stayed on your page for longer than a certain time such as with longer sales letters, landing pages, etc. With the automatic timed deactivation feature you can set ZERO BOUNCE to not redirect visitors who have stayed on your page for a certain amount of time!

Mobile/Desktop Toggle
Want to only redirect desktop users? No problem! Want to only redirect mobile users? Again, no problem! ZERO BOUNCE lets you choose to redirect only desktop or only mobile users if you wish for enhanced demographic targeting!

UPDATE – Version 1.1

In this version there are several new features:

Redirect only X percent of visitors.

As soon the mouse leave the browser window the visitor gets redirected.

Redirect visitor only once.

Inside every post and page in wp-admin (at the bottom) is new option – “Force enable” – If activated, the visitor will get redirected even if Zero Bounce itself is deactivated in settings.

Overall performance is improved and infinity loop is fixed.

Here are some of reviews:

image