php – Creating Conditional Fields in Elementor Custom Widget

How are conditional fields or field groups created in Elementor? I’ve not found anything in the documentation regarding conditional fields for widget development. A simple example of what I’d like to do is the following:

I have a dropdown:

    // Select Control
            'label' => __('Dropdown Example', 'vs'),
            'type' => ElementorControls_Manager::SELECT,
            'options' => (
                'default' => __('Default', 'vs'),
                'yes' => __('Yes', 'vs'),
                'no' => __('No', 'vs'),
            'default' => 'default',

If the answer in the dropdown is yes, then show text field 1:

    // Text 1
            'label' => __('Text1', 'vs'),
            'type' => Controls_Manager::TEXT,

Else, show text field 2:

    // Text 2
            'label' => __('Text2', 'vs'),
            'type' => Controls_Manager::TEXT,

android – Widget display icon

From android documentation, on a widget I can get the info icon with this:


In the documentation, it is written:

     * The icon to display for this AppWidget in the AppWidget picker. If not supplied in the
     * xml, the application icon will be used.
     * <p>This field corresponds to the <code>android:icon</code> attribute in
     * the <code>&lt;receiver&gt;</code> element in the AndroidManifest.xml file.

But more practically, how can I display it in my app (it is a widget icon from another application)

php – Magento 2 Sort order on catalogue widget

I have a working widget that shows the products but how can I get the products to be sorted by the name. I have researched and a-lot of options show how to add a button that will sort the products but im looking for a way to have it by default sorted by name.

<?php if ($exist = ($block->getProductCollection() && $block->getProductCollection()- 
 >getSize())) : ?>
$type = 'widget-product-grid';

$mode = 'grid';

$image = 'new_products_content_widget_grid';
$items = $block->getProductCollection()->getItems();

$showWishlist = true;
$showCompare = true;
$showCart = true;
$templateType = MagentoCatalogBlockProductReviewRendererInterface::SHORT_VIEW;
$description = false;

<div class="block widget block-products-list <?= /* @noEscape */ $mode ?>">
    <?php if ($block->getTitle()) : ?>
        <div class="block-title">
            <strong><?= $block->escapeHtml(__($block->getTitle())) ?></strong>
    <?php endif ?>
    <div class="block-content">
        <?= /* @noEscape */ '<!-- ' . $image . '-->' ?>
        <div class="products-<?= /* @noEscape */ $mode ?> <?= /* @noEscape */ $mode ?>">
            <ol class="product-items <?= /* @noEscape */ $type ?>">
                <?php $iterator = 1; ?>
                <?php foreach ($items as $_item) : ?>
                    <?= /* @noEscape */ ($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
                    <div class="product-item-info series-widget-felix">  <!-- max-width: min-content; -->
                        <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo">
                            <div class="img-widget-felix">
                                <?= $block->getImage($_item, $image)->toHtml() ?>
                        <div class="product-item-details details-widget-felix">
                            <strong class="product-item-name">
                                <a title="<?= $block->escapeHtml($_item->getName()) ?>"
                                   href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>"
                                    <?= $block->escapeHtml($_item->getName()) ?>

                            $delivered_lumens = '';
                            if (null !== $_item->getCustomAttribute('delivered_lumens')) {
                                $delivered_lumens = $_item->getCustomAttribute('delivered_lumens')->getValue();
                                $lumens =  max (explode('-', $delivered_lumens));

                            $aperture = '';
                                $aperture = $_item->getAttributeText("aperture_size");

                            $product_name = $_item->getName();
                            $isMiniTrack = false;
                            if (stripos($product_name, "mini-track") !== false){
                                $isMiniTrack = true;

                                if($lumens > 0){
                                    <label> <?= $aperture ?> | <?= $lumens ?> lm</label>

                                <?php }
                            } ?>

                    <?= ($iterator == count($items) + 1) ? '</li>' : '' ?>
                <?php endforeach ?>
        <?= $block->getPagerHtml() ?>

flutter row widget space between doesn’t work. how can i fix this?

enter image description here

enter image description here

I wanna give space between Math and A+.

I tried

  1. mainAxisAlignment.spacebetween
  2. insert Spacer()
  3. wrap with Container() and give width : infinity

all doesn’t work. don’t know why
here’s my code

 body: Container(
        margin: EdgeInsets.only(top: 5),
        child: ListView.builder(
          itemCount: 20,
          itemBuilder: (context, index) {
            return Container(
                decoration: BoxDecoration(
                  color: kFadingBackgroundColor,
                  borderRadius: BorderRadius.all(Radius.circular(5.0)),
                  boxShadow: (
                      color: Colors.grey(200),
                      offset: Offset(0.0, 2.5), //(x,y)
                      blurRadius: 2.0,
                margin: EdgeInsets.symmetric(horizontal: 70.w, vertical: 10.h),
                padding: EdgeInsets.only(
                    top: 5.0, bottom: 8.0, left: 45.w, right: 45.w),
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: (
                      child: Column(
                        children: <Widget>(
                          // SizedBox(height: 5),
                            backgroundColor: Colors.transparent,
                            child: Image.asset('assets/images/math.png'),
                    SizedBox(width: 30.w),
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: (
                          child: Row( ✅✅✅✅✅✅✅✅✅✅✅✅✅✅✅
                            // mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: (
                                style: TextStyle(
                                    fontSize: 100.sp, color: blueGray),

                              // SizedBox(
                              //   width: double.infinity,
                              // ),
                              // Spacer(),
                                style: TextStyle(color: blueGray),
                          width: 300,
                          child: Text(
                            'hellowoasasasasassssssssssssssssssssssssssssssssssssssssssssssssssssssssssssrld lroremkasdasdasdasdasdsadasdasdasdasdasdasdasdasdremmws',
                            softWrap: true,

It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.

sidebar – How can I add custom class to a link in the navigation menu after attaching it to a widget?

I added a widget called “Footer-1” by adding the following code to my functions.php class

        'name'          => esc_html__( 'Footer Column 1', 'wp-bootstrap-starter' ),
        'id'            => 'footer-1',
        'description'   => esc_html__( 'Add widgets here.', 'wp-bootstrap-starter' ),
        'before_widget' => '<div id="%1$s" class="col-12 col-md-6 col-lg-4 widget %2$s">',
        'class'         => 'wt222',
        'after_widget'  => '</div>',
        'before_title'  => '<h3 class="text-light">',
        'after_title'   => '</h3>',

Then I added a menu called “policies” to the footer one. It is showing up correctly. However, I want to add a css-class “text-light” to each link in the menu items.

I tried adding it using the nav_menu_link_attributes filter. But it does not seems to work when the menu is attached to a widget. If I injected the menu using wp_nav_menu(('theme_location'=> 'priorities')) menu the class gets added. However, when I attach the same menu to the widget it does not add the class.

add_filter( 'nav_menu_link_attributes', 'menu_add_class', 10, 3 );

// Adds text-light class to each link in the policies menu
function menu_add_class( $atts, $item, $args ) {

    if($args->theme_location === 'policies') {
        $atts('class') = 'text-light';
    return $atts;

How can I correctly add the css-class to each link in the menu?

8 – Date Field Type – Text Field Widget is Gone?

I have a use case where the user needs to be able to copy the date
from another source and paste that value into the date field.

This will allow you to paste in and change the date format.

enter image description here

Note: composer won’t install the library for you, you have to manually get the /dist folder from github and put in in the /libraries folder. So it has the /libraries/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js structure.

Similar but don’t quite do it

Datetime Flatpickr Allows change date format, but doesn’t allow you to type in nor paste.

Bootstrap DateTime Picker Allows you to type in and paste, but doesn’t allow changing the date format.

Single Date Time Picker doesn’t allow you to type in nor paste in nor change the time format.

8 – Date Field Type – Text Field Widget

I am noticing that the Date field type only has the availability of three widgets:

  1. Select list
  2. Date and time
  3. Select list, no time

Can someone tell me why the “Text Field” widget is gone? Or am I missing something?

I have a use case where the user needs to be able to copy the date from another source and paste that value into the date field. It would be too time-consuming to have to pick the date from a “date picker” widget. It would be ok if it were a one-off situation but this user needs to be able to enter several at a time.

entities – Change entity reference field widget based on condition?

I am using Drupal 8. In user registration form, i am using entity reference field to a profile. I wanted to display inline entity reference form widget or entity select widget based on role.

For this, I an trying to use hook__field_widget_form_alter(). But have not succeeded. Is there any way to solve this problem?

customization – Remove widget name (“Widgetsmith”) under iOS 14 home screen widgets?

In response to the question:

Is there any possible way to remove the “Widgetsmith” title under the widget on the home screen? It ruins the vibe sometimes (twitter)

David Smith, the creator of Widgetsmith, replied:

Unfortunately not. Apple requires that the app name be below every widget. (twitter)

So it appears that it is not currently possible to remove the name label text underneath an iOS home screen widget. You’re gonna see the word “Widgetsmith” a lot:


You can send Product Feedback to Apple so that this is hopefully addressed in a future version of iOS.