Questions tagged [select]
The select tag has no usage guidance.
188
questions
0
votes
1
answer
32
views
WordPress dynamic select with category and authors
I need to create two dynamic selects with PHP code to put in the functions.php file.
For the categories I'm using the following code which works great:
/* BLOG DYNAMIC CATEGORIES SELECT */
function ...
0
votes
0
answers
18
views
Add options to WordPress Blocks form dropdown field
How can I add additional options to the WordPress Blocks form dropdown field? I only see the one option field and can't figure out how to add more.
0
votes
0
answers
44
views
Best approach of implementing multi-select/checkboxes for taxonomies?
I am working on modifying how multi-select is done in a list in a custom wordpress plugin instead of using the default method of holding ctrl and clicking. The point of the plugin is to be able to ...
0
votes
0
answers
12
views
Display the posts in a category with <select id="
I want to display the posts in each category as below
<select id="selectEpisode" style="width: 400px">
<option value="...
0
votes
1
answer
151
views
How to Remove Active css from woocommerce variation?
I have a small pickle.
I can't figure out how to turn the css off after it gets activated.
If the user changes their mind, I want the yellow to turn off if they deselect the button (variation). I can'...
0
votes
1
answer
89
views
HTML dropdown setting not showing last saved value in the database
I want a select-dropdown field to display the last saved option in the database; I started with this video from YT, https://www.youtube.com/watch?v=hbJiwm5YL5Q&t=3969s and got as far as 1:05:00 ...
1
vote
1
answer
314
views
Admin ajax error 400 when passing select value to populate another select
This is my first attempt to write a plugin and I get an error 400 when trying to use admin-ajax.php. I've looked through some topics both here and in the WordPress support forum, but cannot figure it ...
0
votes
0
answers
282
views
Wordpress Gutenberg - Sidebar get posts list based on selected category
I need to display the complete posts list in the dropdown list in the custom block sidebar.
I used for that withSelect:
...
const currentPostId = select('core/editor').getCurrentPostId();
...
0
votes
1
answer
93
views
How to make HTML select options searchable
What could be easy way to modify source and to make that Select options searchable for attributes in product page? Something like while I typing, it suggest value.
<div id="product_attributes&...
0
votes
0
answers
189
views
Database SQL query error
I am trying to run below query.
$sql = "SELECT * FROM `wp_podsrel` WHERE `related_item_id` =$user->ID AND `pod_id` = 17 AND `field_id` = 25";
$results = $wpdb->get_results($sql) or ...
0
votes
1
answer
537
views
echo selected value from dropdown
This is for a custom type post, I have a custom field (a drop-down list) when I select an option in the dropdown let's say "DesignApplication" and save the post.
Then when I try to update ...
0
votes
1
answer
44
views
Multiple Custom Taxonomy Dropdowns Lists
I have 3 hierarchical (category-like) custom taxonomies in a WP site, books, characters and writers. I want to create a dynamically populated dropdown menu of terms for each of these in the site's ...
0
votes
1
answer
146
views
How to get last user with wpdb?
can someone please help me with this query:
$ultimousuario = $wpdb->get_var( "SELECT TOP 1 FROM $wpdb->users WHERE user_login = 'usuario*' ORDER BY user_login DESC");
echo "<p&...
0
votes
1
answer
65
views
Add default value from selection <select>
working on my first plugin where a user can select an option from a dropdown and this selection gets saved in a code that gets written into the footer. That works, but the problem is, my default ...
0
votes
1
answer
136
views
Why can't I return a value from $wpdb->get var?
I am trying to delete a record from a table when a condition is met. The condition is this: If there is a record in Table 1 that fails to match a record in Table 2, then delete the record from Table 1....
1
vote
1
answer
798
views
SELECT rows between two datetimes when the range is dynamic [closed]
I'm trying to select rows that fall into a certain date range from my database table. The range is determined dynamically by the user.
In my database I have a column called "dateAndTime". It ...
0
votes
1
answer
676
views
Populate select list with meta values from all posts of a Custom Post Type
I've got a CPT of Inventory and I'm trying to show a dropdown of all Mfrs. I've got the form and pre_get_posts function so that when a user selects a Mfr, the page refreshes and shows only the ...
2
votes
0
answers
106
views
Custom widget select options needs to stay selected after save
I am working on a custom widget that includes a select options drop-down list of pages. When I select a page and save, the selected option does not stay selected. However, if I refresh the widgets ...
0
votes
0
answers
21
views
WordPress Gutenberg Signal on Block Alignment Change
Is there any selector I can use to subscribe to an block alignment change? I am writng a custom block that needs to do some actions when the user changes the block alignment to 'wide' or 'full'. I ...
0
votes
0
answers
564
views
How to make a pagination with dropdown selection?
This is the code for the dropdown pagination. It uses a js controller too, but it works fine, so, I’m not adding it.
$total = $wp_query->max_num_pages;
// only bother with the rest if we have more ...
0
votes
1
answer
327
views
show label text of select option rather than its value in cmb2
I am trying to display the label text of my CMB2 select not the value on the frontend. Currently my select field displays a list of a specific custom post type called fleet. When I add $gas = ...
0
votes
1
answer
164
views
CF7 select value get to function and reciept value from function
Si I try to asking different
How I can get the value from following field:
<label> Geburtsjahr/ année de naissance (Pflichtfeld)
[select* annee include_blank "1940" "1941" &...
0
votes
1
answer
197
views
Filter multiple dynamic dropdown lists within one form using the Smart Grid-layout extension for Contact Form 7
I recently found solution for populating dropdown list with terms relative to the post. Everything works but I need to use this code on multiple dropdown lists within one form.
My code looks something ...
0
votes
1
answer
471
views
How to search usermeta table
What is the best way to search usermeta to find a user_id based on a meta_value? For example in usermeta table there is a row with user_id = 123 , meta_key = deviceid and meta_value = 45545.
I know ...
0
votes
1
answer
213
views
Fill custom select field with pages/post titles
I'm just getting into the world of SAGE development and at the same time, I'm using the Advanced Custom Fields plugin.
Let's say, that we have created two custom post types (Professors, Lessons). ...
1
vote
0
answers
311
views
Gutenberg get core data - search
I am trying to query data in gutenberg like search in REST API. Following this documentation:
https://developer.wordpress.org/block-editor/data/data-core/
I came up with this select:
wp.data.select(...
0
votes
0
answers
38
views
Load google font script based on optgroup label selected
Ive searched and can't find an answer. I have two groups of fonts - one regular fonts and one google fonts. Im using a select dropdown list with two optgroups, one for each group of fonts. What Im ...
1
vote
1
answer
1k
views
Populate dropdown from database
I am creating a custom plugin for our martial arts school and have come up against a problem that is doing my head in. No doubt I am missing something obvious but have never really dealt with ...
0
votes
1
answer
1k
views
ACF Dynamic select not showing data
I have a question. I have 2 types of custom field group: Group A and Group B. All I am using ACF.
In Group A, I have field name course_trainer. This field type is a User type and can have multiple ...
1
vote
1
answer
1k
views
Modify output of wp_dropdown_categories to add term IDs to each option
I've been searching for documentation or examples on how to modify the output of wp_dropdown_categories so I can add the term ID to each option. Is this possible? If not, my only thought would be to ...
-1
votes
1
answer
836
views
Can't add Select2 to select in variable product (admin)
I'm trying to add select2 to an input in WooCommerce variable product admin.
I've added select2 to a class so it can be reused, however, it seems it's not working. It's working anywhere else on the ...
2
votes
2
answers
211
views
WordPress setting with select - where is my mistake?
I have two option callbacks in my plugin, one with a ckeckbox and one with a select field. The first one is working perfectly, the second not. The select field doesn't save its value. I double checked ...
0
votes
1
answer
399
views
How to populate a select field with post titles/ids in a block
I need to build a really simple block with just one select field. This select field should be populated with the titles/ids of posts of a specific post type. Once a user selects one post from this ...
0
votes
1
answer
131
views
Metabox multiple custom post select -> display selected items?
I'm building a theme that needs some cross-information(?) between custom post types.
I have a metabox to select custom post types and display them inside the single page of another custom post type. ...
0
votes
1
answer
516
views
how to SELECT meta values that are not null?
I have a rating system for our products but there is an issue:
by the code, that will SELECT all comments in commentmeta table that have rating as meta_key. even those who do not have a rate (the ...
0
votes
1
answer
2k
views
Get value of selected option in select field in a Wordpress form
So I am trying to get which option is selected without submitting it to server side. I have 2 drop down fields, the first one is of last names and second one is of first names. Both are populated from ...
-1
votes
1
answer
1k
views
Query a Custom Post Type using SELECT that has ACF fields to compare dates
So I have a CPT called ads that has ACF fields of ad_start_date and ad_end_date. I am trying to write a custom WP query using a SELECT statement instead of using WP_Query because I am return an ajax ...
0
votes
1
answer
625
views
Reload page with a different shortcode when a user selects from a dropdown
I'm using WP Job Manager, and the page which lists all available jobs is delivered using a shortcode which can be customized.
so [jobs per_page="10"] is outputed in the frontend as:
<div class="...
0
votes
1
answer
3k
views
choose selected for select option with condition [closed]
I have a select option like this
<select name="select1">
<option value="value1">hots</option>
<option value="value2">popular</...
0
votes
2
answers
7k
views
How to set different color in a select box due to selection with css
I have a select box with 2 options. In the selct area the options are
green for 1
red for 2
I had been able to set green also as the color for the predefined option.
Now I would like to change this ...
1
vote
0
answers
303
views
How to output CMB2 select options from repeated groups select elements?
I've searched in previous posted questions but I can't find something similar (but if it's already posted, please let me know).
I've got the following repeated group of fields, with a select in it:
$...
0
votes
1
answer
1k
views
Custom Meta Box (SELECT) Not Saving
I am trying to create a meta box with select options for each page with home-page-template.php assigned to it. I have got that functionality working correctly.
I also want it above the editor, below ...
1
vote
1
answer
186
views
Creating select dropdown with parent-level custom post types
I'm trying to create a dropdown with an option for each top-level parent. I've gotten the query down because when I print the results, I see the posts I'm looking for. My code is also creating the ...
2
votes
1
answer
31
views
Export posts manually selected by end user (not logged in)
For an intranet project, I'd like to have not logged in users be able to manually check posts (with checkbox in front of post title on archive page) and be able to export some predefined data about ...
0
votes
1
answer
229
views
Nested select statements not working
I have 2 tables I need to search.
1st table
Name: Personnel
Fields: id, lname, fname, department, extension
2nd table
Name: department
Fields: id, department
The 2nd table has the full department ...
0
votes
1
answer
241
views
Woocommerce add a text field if specific option is selected
I need to make active/visible a new filed before 'Add to cart' button, only if user select a specific option.
The case is simple: I sell t-shirt with options: "Small", "Medium", "Large", "Size upon ...
0
votes
1
answer
5k
views
Sorting dynamic select/dropdown for Contact Form 7 of Modern Tribe Events posts
What I have is a dynamic dropdown/select box in Contact Form 7 I believe to be based on this: https://gist.github.com/morgyface/56474f0a37abb7d622880daf6eff6e40
It's been a while since I worked on ...
1
vote
1
answer
3k
views
Wordpress select field - show current value?
Function is generating select field, what can I do to set 'selected' currently saved value ... if possible?
For example, previously I selected 36 and saved "update_option('_nos',$myvalue)"
function ...
1
vote
0
answers
16
views
Add select input with pre defined classes to insert image screen?
I'm looking for a way to add a select element (or some multiselect variant) with pre-defined classes to the image insertion screen in Wordpress.
I've been looking around for some way to do this but ...
0
votes
2
answers
3k
views
Multiple selection for wordpress widget
I created my own category selection widget. So i used <select> but i want to use with multiple attribute.
Here is my widget class. It works perfect without multiple attr. But i want to use it. ...