Getting the dropdown menu to redirect to different pages?

ok so i figured it out… i changed the select to <select onChange=”this.form.submit()” name=”page_id”{$id} class=”$class”> so that name passed in the url gets changed to ?page_id which i want since that is the format i am using (default wordpress format), and then i called my page_by_title function (btw i had to change the name of … Read more

Search results sorted by post types

You can use filter posts_clauses For example: add_filter( ‘posts_clauses’, ‘post_query_order’, 20, 1 ); function post_query_order( $pieces ) { global $wpdb; $pieces[‘orderby’] = $wpdb->prefix.’posts.post_type ASC’; return $pieces; }

Archive dropdown styling not applied

You’re targeting cd-dropdown with a class indicator (the period), the cd-dropdown is an ID and should therefore be targeted with the ID selector (a hashtag). #cd-dropdown > span, #cd-dropdown ul li:nth-last-child(-n+3) span { box-shadow: 0 1px 1px rgba(0,0,0,0.1); }

wp_dropdown_pages default value

I would suggest, that you switch from “URl query argument” style to arrays. This is a “feature” that is more a left over on some functions that is only available for backwards compatibility reasons than anything else. Here’s a reworked version of your current arguments: wp_dropdown_pages( array( ‘title_li’ => ”, ‘depth’ => TRUE, // originally: … Read more

How to retain the values from dropdown category lists after wrong form submission?

Like Ash was saying, something like this using $_REQUEST or $_POST will do it. <?php $args[‘exclude’] = “12,20”; // omit these two categories $categories = get_categories($args); ?> <select class=”selectpicker btn-block” name=”coupon_cat” id=”category”> <option value=””>Категори Сонгох</option> <!– if nothing else is selected, this will be selected automatically –> <?php foreach($categories as $category): ?> <?php $selected = … Read more

Drop-down menu with wp_dropdown_pages

First of all, i think you got an error in your arguments. It should be ‘show_option_none’ => ‘Select Page’, not ‘show_option_none=Select Page’. Secondly: Shortcodes are things that are replaced within the content of the post/page/whatever. This means that the content of the Shortcode has to be returned. You directly echo them, which leads to the … Read more

How to get a list of taxonomy terms which are being used only within certain post types?

I’m not a programmer so there’s probably a far more efficient/correct way of doing this. Put this in functions.php or a custom plugin: function get_terms_by_post_type( $taxonomies, $post_types ) { global $wpdb; $query = $wpdb->get_results( “SELECT t.*, COUNT(*) from $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN $wpdb->term_relationships AS r … Read more

How to add country drop down menu to the user profile?

Try this /* Save selected data */ add_action( ‘personal_options_update’, ‘save_user_fields’ ); add_action( ‘edit_user_profile_update’, ‘save_user_fields’ ); function save_user_fields( $user_id ) { if ( !current_user_can( ‘edit_user’, $user_id ) ) return false; update_usermeta( $user_id, ‘country’, $_POST[‘country’] ); } add_action( ‘show_user_profile’, ‘Add_user_fields’ ); add_action( ‘edit_user_profile’, ‘Add_user_fields’ ); function Add_user_fields( $user ) { ?> <h3>Additional Field</h3> <table class=”form-table”> <tr> <th><label … Read more

Add submenu using the bootstrap wp_nav_menu

You will need to write a custom menu walker. See this code for the walker. (Or do a search for “Bootstrap Menu Walker”.) Then use: wp_nav_menu( array( ‘menu’ => ‘header’, ‘menu_class’ => ‘nav nav-pills’, ‘container’ => ‘nav’, ‘container_class’ => $classes, ‘fallback_cb’ => false, ‘depth’ => 2, ‘walker’ => new Bootstrap_Walker_Menu_Nav(), ‘theme_location’ => ‘header’, ‘echo’ => … Read more

Select dropdown not showing selected value php

The reason your $item == $option condition is always failing is because of the way PHP compares floats! Try the following instead: echo “<option value=”$item”” . selected (abs ($item – $options) <= 0.01, true, false) . “>$item</option>” ; See Comparing floats for more info.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)