Questions tagged [select]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
1k views

Retrieve select tag custom values from array and display them in current page with wp_query?

I have a select tag (in filter.php) with different training prices ($80, $120, $500, etc). The values are stored in the array $options (thanks to Tom) : I'd like to display, when visitor clicks in $...
0
votes
1answer
233 views

Create multidimensional array of taxonomies

Create multidimensional array of taxonomies Hello all, I need to create a multidimensional array to populate my select via javascript. At the beginning are two selects of taxonomies, 'store' and '...
0
votes
1answer
13k views

Custom contact form 7 select with custom values [closed]

I have been searching for a way to add a select field to the Contact form with custom data. The goal is to have a form where someone can ask for information on an article by selecting the article ...
0
votes
0answers
1k views

add image in dropdown select

if (!function_exists('dropdown_categories')) : function dropdown_categories($show_option_none, $name, $selected = '') { if (of_get_option('blog_cat_id')) { return apply_filters('...
0
votes
1answer
347 views

Get Link of Page Selected through a Select Field in Custom Admin Page

I've created a list of pages in the backend of a Wordpress site using wp_dropdown_pages();, which of course shows a dropdown of existing pages. What I'd like to achieve is retrieving not the name but ...
0
votes
1answer
1k views

Default URL for category dropdown select option

I have a dropdown menu for my categories: <form action="<?php bloginfo('url'); ?>" method="get" id="catform"> <?php $parent = get_cat_ID("Pictures"); $select = ...
0
votes
3answers
252 views

ACF Pro select field problem [closed]

I am trying to use ACF Pro Select field to display a specify social media icons. So I have this code in my theme: <?php if( get_field('social_medias', 'option') == 'facebook' ): ?> &...
0
votes
3answers
117 views

How to convert select to HTML with PHP tags inside of it [closed]

I apologize for asking such a simple question, but I am having a world of struggle in trying to convert the following echo statement to HTML with php tags inside of it. I am trying to get my custom ...
1
vote
0answers
475 views

Woocommerce Product Custom Select List (not variation)

I'm not asking anyone for a whole solution (although I'd gladly accept), but rather for someone to point me in the right direction as to how to accomplish this. I am a web designer with intermediate ...
0
votes
1answer
24 views

database select issue

I am writting plugin where i have custom table. I am trying to access one random row from last 5 rows from this custom table. "SELECT * FROM $table_name WHERE id > MAX(id)-5 AND id < MAX(id)+1 ...
1
vote
1answer
747 views

How to make drop down post title

I am developing a website using WP CMS where I want to implement post title as drop-down list as well as when users select a drop-down title the content show below within reload. I am here. What will ...
0
votes
1answer
42 views

Select field value not returned after saving changes

I've been searching around for an answer to this one but have had no luck thus far… forgive me if it has been answered somewhere before! I'm currently writing a plugin and I'm using the WordPress ...
0
votes
1answer
791 views

How to call custom jQuery plugins into the customizer controls

I never tried to use the theme customizer, somehow I don't find that thing good. But recently I tried it, and stuck into this matter. I extended the Class WP_Customize_Control to made my own <...
1
vote
1answer
43 views

Need a help on sanitization

I have a theme on review, and I do add section 'type'=> 'select' on few occasions like this. $wp_customize->add_setting( 'personal_lite_post_link', array( 'default' => 'enable', ...
2
votes
3answers
12k views

Select dropdown not showing selected value php

I'm using Wordpress Settings API. Everything works as it should except this select dropdown. When I select an option, the value echoed is correct but in the dropdown it displays the default first ...
0
votes
0answers
667 views

Implementing Select2 plugin into Wordpress

I am currently trying to implement the Select2 plugin in my Wordpress site to get the beautiful dropdown select boxes that allow users to select multiple items. I have pasted the following code ...
0
votes
1answer
51 views

SELECT statement wrong?

This code works correctly down to the eighth line from the bottom. The SELECT statement there does not find the one record that was just inserted. It is the only record in the table at this point. ...
2
votes
2answers
34k views

Style the last element having a specific class [closed]

I have a code like this. <div class="slick"></div> <div class="slick active"></div> <div class="slick active"></div> <div class="slick active"></div> &...
0
votes
1answer
1k views

How to Display image from Menu Image in Walker Dropdown Select Menu

Created a custom menu list, titled Country that has flags representing countries (only Canada and USA) using the plugin Menu Image I combined this menu with Walker, to create a dropdown. I however ...
0
votes
2answers
6k views

add onchange to select in a wp form

I am using wp_dropdown_categories to create a dropdown in the frontend. It creates a nice dropdown select. Now I would like to add onchange="myFunc()" to the <select>. I need this to trigger ...
6
votes
2answers
12k views

How to correctly submit a search form and display the result in an independent page

I have part search function in my WordPress website which uses dynamic dependent select box. However, now I have the following problem: If only select the first one box, or select the first two ...
4
votes
1answer
95 views

Wordpress parent select need to be removed

Hi i have a Wordpress installation with over 35000 pages which are sorted into trees like so ... There is an ongoing issue with page edit loading very slowly or failing to load at all. Through long ...
0
votes
1answer
525 views

WordPress Multiple Taxonomy Query

I've a simple form made up of two multiple selects which (as if by magic) filters my posts archive with URL parameters: <form class="filters"> <select name="country" multiple> ...
0
votes
1answer
48 views

Get 3 row ID's via ARRAY_A

Below query works fine. But how can I select the 3 results separately with the array_number? I need to separate the 3 results correct with help from the array_number. But do not know how. $records = ...
2
votes
2answers
3k views

Triple meta_key on custom SELECT query

I'm using a weird SELECT query to calculate the average of all the post ratings (stored in wp_postmeta) for a certain user. My query basically uses the following arguments: post_author = 1 AND ...
1
vote
0answers
1k views

How to add select list to meta box field?

I have created custom meta box field product_statuss to my CPT product. I want to predefine four possible statuses and display them as dropdown list but have spent 4+ hour running the same error. Here ...
2
votes
1answer
1k views

How to replace a javascript select box onchange event to a form submit action?

I have a small problem that probably has a very simple fix. I have been using the wp_get_archives() function to produce a dropdown select form. See the full code below: <form id="side-arch"> ...
1
vote
0answers
41 views

wp_Qwery works to slow

I have 266 806 rows in wp_posts, and when I'm trying to get post this help of WP_Query or DB SELECT which sort parameters it's gets results more when 0.3ms Exemple of SELECT: SELECT ...
0
votes
2answers
228 views

Display posts by combining multiple meta key

Basically a post is an event therefor will be displayed once or twice, depending on meta key. Every post has at least two meta keys $start_time_1 and $end_time_1. Let's say i have two posts, title: "...
3
votes
0answers
60 views

Select menu should display categories and the item's depth

I have a select menu of a custom post type in the header.php: <?php $selectloop = new WP_Query( array( 'post_type' => 'products', 'posts_per_page' => -1 ) ); echo '<form>&...
1
vote
1answer
684 views

Can I limit term selection to one plus parent?

So i have a custom post type (listings) and a custom taxonomy (listing_terms). The taxonomy has parent/child terms. Eg: Restaurant -> Cafe (where Cafe is the child of Restaurant). I want to only let ...
1
vote
0answers
11 views

Selecting and outputting results from DB with an array

I have always had issues with arrays. I can never seem to get them to work correctly. Could someone advise me. I want to make a selection from the database, use that in another selection and then ...
-1
votes
1answer
35 views

Tool to check the database in Production [closed]

I Would like to use a tool to execute SELECT requests on the PRODUCTION database. This tool must be full security because my site is deployed on Internet. Any idea ? Regards
2
votes
1answer
983 views

Populating dropdown menu with hierarchical taxonomies

Im currently populating my <select> elements (I've got plenty of them) with nested foreach loops, get_terms() and &nbsp;&nbsp;&nbsp;&nbsp; to create padding for each nested child ...
1
vote
2answers
738 views

How to number the options in a wp_dropdown_pages() select?

I'm using wp_dropdown_pages() but would like to number the options returned for the user. So instead of something like... <option value='http://someurl'>item one</option> <option ...
2
votes
2answers
5k views

$wpdb-prepare : Do I have to bind a parameter to the table name?

I only do a SELECT on a whole table - and the table is defined in a variable: $table = $wpdb->prefix . 'members'; Do I have to bind a parameter to this variable? This caused an error: $result = ...
0
votes
1answer
2k views

SELECT query with prepare and placeholder for string

I am trying to learn how to do a simple Select query using $wpdb-prepare. I am checking wether an email submitted by the user is already available in the database. There has to be something wrong ...
1
vote
2answers
3k views

Display tags from specific category in select fields

I am looking to display all tags in select form that are from posts that have been assigned to a specific category. I am using the following code to generate every tag in a select form <div> &...
0
votes
1answer
123 views

Adding option values as an array using a multi selectable select box

I have a plugin I'm developing. As part of its functionality I need to set up an option group and specify an option var for that group: function swcs_settings() { register_setting( 'swcs-settings-...
0
votes
1answer
488 views

Custom Select Query pagination not working properly

I have Custom Select Query joining two tables and displaying events older than current date. Everything works fine until I try to paginate it. <?php global $wpdb; $date = date("Y-m-d");...
0
votes
1answer
3k views

Custom select query two tables by a meta key

I'm using an event plugin which creates wp_ftcalendar_events table in database with start_datetime column. Here's image of whole table: I want to query my posts by start_datetime. I know that I can't ...
0
votes
1answer
48 views

Add category selection to function request

Got the following in my functions file, which is designed to query the last three posts published, however I want to limit it by a certain category. I was looking at adding is_category to the WHERE ...
0
votes
1answer
2k views

Making jQuery .change() event persistent after widget save

I'm creating a custom widget that uses a select element with a bunch of options and a simple jQuery function to trigger the visibility for some <div>s below it based on the selection, through a ...
1
vote
2answers
2k views

Select query for a login

I'm trying to make a login form, but select query isn't working. Is there another syntax in WordPress and in which way is password hashed? My code is: if ( isset( $_POST['submit'] ) ) { if ( !$...
0
votes
1answer
173 views

Read post meta values, only if posts are public

I want to retrieve meta_values applied to posts. Currently I execute the following query global $wpdb; $table = $wpdb->prefix.'postmeta'; $values = $wpdb->get_results( "SELECT meta_value ...
0
votes
1answer
562 views

Selecting NULL value from the database

I have a database with columns that are allowed to be NULL. Whenever I run a query against this database using $wpdb->get_results the columns that are NULL are always returned with an actual value;...
1
vote
2answers
2k views

Select box saves but doesn't update value in admin

I have a select dropdown in my custom meta box in the admin area. It offers two options Approved and In Progress. When I select an option and save it the database is updated, but the value in the ...
0
votes
0answers
676 views

Ajax Form data is not posted back to the get_results()

I am trying to run a wordpress wpdb->get_results select query and I want to get the search criteria from a textbox. I want to do it form and with ajax without refreshing the page. No matter what I do ...
0
votes
1answer
179 views

Ajax Query returns zero

I am doing simple wordpress select query and want to do this with ajax jquery and do not want the page to refresh when I press search button and writing text in search textbox. As soon as I press ...
0
votes
1answer
967 views

Custom Taxonomy Select Menu: Setting default option value?

I'm creating a series of select drop down menus that pull data from various taxonomies. I got this PHP script working for a WooCommerce attribute of color: function get_color_dropdown($taxonomies, $...