I have created a post filter like the image below, but I have an issue with selecting multiple values from different fields. All the fields in the filter are custom fields. The thing is, in the admin panel, one post has a select field with city Telaviv and with a select field Property Type with a value Garden Apartment. The other post has a different city and Property Type as Ground Apartment. On the front end, if I choose from …
so i have a custom post type with hierarchical structure. Looks like this: top level 1 - child -- grand child -- grand child - child -- grand child top level 2 - child -- grand child -- grand child - child -- grand child top level 3 and so on. I need a query with top level id as a base and query through all child and grand child pages of that top level page? I know ther is …
I've a custom post type with some custom meta box. I want to filter my custom post type posts using custom meta value. I've written the code below. But it return no post found. Can anyone tell me where I did wrong? Here is the codes. <?php add_action('restrict_manage_posts','restrict_listings_by_metavalue'); function restrict_listings_by_metavalue() { global $typenow; global $wp_query; if ($typenow=='jspp_std') { echo '<input type="text" name="adate" id="adate" placeholder="Enter Admission date" />'; } } add_filter('parse_query','jspp_custom_meta_query'); function jspp_custom_meta_query($query) { global $typenow; global $pagenow; if( $pagenow == …
I have this... $args = array('child_of' => 3422 ); $categories = get_categories( $args ); foreach($categories as $category) { echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all members in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> '; } I can't find a way to add a separator between each term?
Currently, we are getting all posts from a specific category using the following: $args = array( 'post_type' => array('post'), 'cat' => 1247, 'posts_per_page' => 4 ); What we'd like to do is get all posts from cat 1247 and also from custom post type 'videos', such as: $args = array( 'post_type' => array('post', 'videos'), 'cat' => 1247, 'posts_per_page' => 4 ); However, as none of the posts in 'videos' are from category '1247', it's only showing posts from '1247', however …
I want to use get_terms() for a taxonomy in such as way as to emulate MySQL's ORDER BY FIELD e.g., ...FIELD ('aaa','ccc','bbb','eee','ddd') A var_dump snippet currently looks like: object(WP_Term)#1861 (10) { ...["slug"]=> string(3) "eee" object(WP_Term)#1862 (10) { ...["slug"]=> string(3) "bbb" object(WP_Term)#1863 (10) { ...["slug"]=> string(3) "aaa" object(WP_Term)#1864 (10) { ...["slug"]=> string(3) "ccc" object(WP_Term)#1865 (10) { ...["slug"]=> string(3) "ddd" Have been reading the codex but I'm missing something. Here's what I have: $args = array( 'orderby' => 'include', 'order' => 'ASC', …
Today I needed to change the arguments on a custom taxonomy that was already registered by a third party plugin. Specifically I wanted to set the show_admin_column argument to true and change the rewrite slug so that it wasn't just the taxonomy slug. In this case, it was a "People" post type with a "People Category" custom taxonomy. I was surprised this wasn't asked before, so here's a question and answer.
I'm hoping that Its just my tired eyes missing something and a fresh pair of eyeballs might catch what I'm missing. I have a custom taxonomy with a slug of 'residential_project_types' that is assigned to a custom post type of residential_projects. I want to display all terms from the taxonomy, outputting the term name and link. Its KIND OF working... Instead of displaying a single term for each, it appears to be displaying a term for every post included in …
How can I remove the h2 tag used in the screen reader text? I use the following $args, but h2 is still in it: the_comments_pagination( array( 'add_fragment' => '', 'screen_reader_text' => __( '<h3>Test</h3>' ) ) );
For example, this works: 'default' => '#ffffff' But this does not: $white = '#ffffff'; 'default' => $white How can I pass variables to key/value pairs? Here is a more complete example for some context: $white = '#ffffff'; $transport = 'refresh'; $wp_customize->add_setting('mytheme_text_color', array( 'default' => $white, 'transport' => $transport )); In reply to jgraup: This code works: $wp_customize->add_setting('themeone_primary_nav_background_color', array( 'default' => '#181818', 'transport' => 'refresh' )); This code doesn't: $args = array('default' => '#181818', 'transport' => 'refresh'); $wp_customize->add_setting('themeone_primary_nav_background_color', $args); When I …
I am creating a custom nav walker. I noticed that the nav walker class from the WordPress core is written rather rough – much of the stuff going on could be spread out through various methods, so I wanted to give that a try. Currently I am wondering how I can get the $args (containing arguments passed to different methods) parameter in my constructor? Giving it a close look, there is the filter wp_nav_menu_args (source) that could be used for …
The custom fields all have prices including $ signs, and a dot as separator. $theQuery = new WP_Query(array( 'orderby' => 'meta_value_num', 'meta_key' => 'price', 'order' => ASC )); All formatted like this: $24.95 $190.00 $1.40 They won't sort correctly due to the dollar sign, is it possible to ignore or remove the first character / $ sign in this WP_Query?
I'm currently working on a site where users can search for apartments. I have a custom post type for the apartment posts, which contain several custom fields. I have a page where i list all of the apartments. What i want to do is have a form, containing check boxes, drop-downs and radio button, where the user can filter apartment posts by custom fields. For example by price or size. So when the users clicks on an check-box for example …
I know this code is incorrect, but it's a basis of what I am trying to achieve. I am parsing an xml feed via PHP and running a foreach loop to get a value from a specific key. Here is the snippet I am using: $feed = file_get_contents("https://www.feedurl.com/xml"); // Feed URL $xml = new SimpleXmlElement($feed); $output = array(); foreach($xml->entry as $entry){ $attributes = $entry->id->attributes(URI_RSS); $im = $entry->children(URI_RSS); // Get item's ID $id = $entry->id; $attr = $id->attributes('im', TRUE); $output[] = …
I started to work on one website after another developer and there is problem with his "popular widget" which is basically showing 3 random posts from category. There is some Switch statement which is regulating to show from category news 3 random post not older then 1 month and for other categories 3 month. I don't understand what he did there with ['interval'] but when I use wordpress time parameters still I don't have results. function getSomePost($category,$postsPerPage=3) { global $post; …
It it possible to get the configuration of a the latest called WP_Query? I need to use it for debugging. For example, if i run something like: $the_query = new WP_Query( $args ); ... Could i get the $args array later by doing something like $the_query->args(); or something?
So I want to have defaults set up for each of my plugins settings, and I'm using wp_parse_args to do so which I believe is the correct way, but I'm hitting a roadblock. Here's my code at the moment: function eddslider_options_each( $edd_slider_options ) { $edd_slider_options = get_option( 'eddslider_options' ); /** * Define the array of defaults */ $defaults = array( 'slider_insert' => 0, 'slider_arrows' => 0, 'slider_bullets' => 0, 'slider_effect' => 'fade', 'slider_theme' => 'default' ); /** * Parse incomming …
I'm working with a client's WordPress site that has user submissions (via TDO Mini Forms) from multiple countries, and they would like to be able to search for posts by region – Europe, Africa, Central America, etc. There is a custom field already in place for the user's country of origin. I also have a separate table that maps countries to regions. What I want to do is make it so that the user can select Europe, for example, from …
I need to debug a problem with filters I have in place. they're affecting any url that includes a query; eg, http://my.domain.hk/?attachment=1. does anyone know in which function WP begins to work with this kind of url, one that includes a query? cheers, Gregory