New answers tagged

0

OK, I added distance as custom field to allow me order them using wp_query orderby method! function add_distance_as_customfield($posts){ $longDest = $_GET['lng']; $latDest = $_GET['ltd']; foreach ($posts as $post) { $placeLocation= get_field('location',$post->ID); $longPlace =...


1

If you have deactivated the first one you should be able to use the new one without any hassle. When the plugin deactivated, WP core don't call any of it function or doesn't use any thing else from it. But if you activated both of them then it can cause function re-declaration etc.


1

At first glance, that should just work, as long as you've flushed your rewrite rules. You can do that by going into the settings and saving permalinks again.


0

You can check woocommerce related conditional tag here - https://docs.woocommerce.com/document/conditional-tags/ You can try below code. In this code add_action execute only when product have category like men or women. function wp_extracode_for_products() { echo'your code'; } add_action( 'wp', 'remove_product_content' ); function ...


0

check the documentation to add something for a particular posts/pages/category http://codex.wordpress.org/Conditional_Tags


0

As per what I have understood is you have a Custom Post type as event and user role like Secretary. Now if a Secretary logged in , he can only be able to see his own events added, not the other one. So if the above is correct so for that, we will use pre_get_posts filter function wp_list_mine_posts( $wp_query_obj ) { // Front end, do nothing if( !...


0

It's a CSS answer rather than a WP answer, but adding !important to your CSS rules should do it. Anywhere in your child theme's CSS that you would like a rule like this... .comment-list .reply a { color: teal; } ... to override the inline CSS then try using this in your stylesheet instead: .comment-list .reply a { color: teal !important; } Any ...


0

If all you have in your child theme is a style.css file and a functions.php file. I would suspect an issue in functions.php. if you used the information on this page Wodpress Child Themes to create your child theme. Then I would suspect an issue with your function names. Try appending your initials to the begging of all your function names and the hook call ...


0

The question isn't very clear to me but i'll attempt to answer anyway, forgive me if it's obvious to you: What you describe is the behavior of "custom post types" When you create custom post types you define a slug like your "suburl" and "suburl2" and all posts created under that type fall under site.com/suburl/post-title I'm sure that if you first create ...


0

Each theme has one config which is associated with options. When you move theme you just have to move option in the database to the key of the theme. Tell me whether this could help you or not. Thank you!


0

It's a bad use of Query you may look at this post In this case use a secondary query with your own instance of WP Query. query_posts() is not recommanded here cause it overrides the main query. <?php $args = array( 'post_type' => 'instrument', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, ); $my_query = ...


0

Here is what worked for me. Preethis answer almost got there, but no data was getting set. I needed to find a way of accessing the data in the array, and I used implode to do it. So here is my final code that enabled me to create a search form that loops and displays categories, allows the user to do a keyword search via any number of categories, and ...


0

I have noticed in the examples you have provided, you're missing the semi colon from the end of the property you're declaring. Try adding this in, or as others have said, and !important to the end of the value. I would've commented but I need 50 rep to do so! While I'm here, I notice you're using a max-width argument. Have you considered a mobile first ...


-2

Try This @media only screen and (min-width: 280px) and (max-width: 767px) { .nav-transperent.logo-light{ display:none !important } }


1

let’s start by defining an HTML search form: <form method="get" action="<?php bloginfo('url'); ?>"> <fieldset> <input type="text" name="s" value="" placeholder="search&hellip;" maxlength="50" required="required" /> <p>Refine search to posts containing chosen tags:</p> <?php // generate list of categories $tags = ...


0

Take a look at the WordPress Template Hierarchy to see how to have different looks for different pages. The template for the front page, for instance, should be named front-page.php. If you follow the naming convention for templates, you don't need to do anything in functions.php


0

First, use a different id for your panel than panel_id. Your sections will not show up without associated controls and settings, and panels will not show up without associated sections. Try adding controls to each section and that should fix your issue.


0

Answering my own question here, for anyone who might encounter this problem in the future. The cause for the right templates not loading was having uppercase letters in my template filename. Changing all characters in the filename to lowercase resolved the problem, and the templates are now being applied as they should. I'm still unsure about what is the ...


0

Google code for displaying custom post items. Fetch all the custom post items in an array and then use a simple html of a drop down and put it in a for loop which will go through all the elements of custom post type. In the value attribute of drop down use the current array value. Below is the html code for drop down wrap it in a for loop and add values as ...


1

As Tim Malone said, WP_Query isn't going to return multiple copies of the same post in its result set. I think you have a design problem and I would suggest you use parent/child posts rather than post meta to accomplish what you want. The following is one approach to doing this. First, register both post types: // The parent event type // There will be one ...


-1

If you care about performance then don't use Avada theme. It is total garbage when it comes to performance. The demo has 27,000 lines/5244 Rules of CSS and 2 dozen inline style sheets. In my experience a complex website with 30-40 different templates could be around 1000 rules and 5-6k lines of css. No cache plugin will save the client from a .7mb css ...


0

What about using this? $args = array( 'post_type' => 'post', 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query' => array( 'relation' => 'OR', array( 'key' => $end_time_1, 'value' => date('Y-m-d H:i'), 'compare' => '>=' ), array( 'key' => $...


1

First, I would use WP_Query instead of the manual DB query (and don't tell me that's because of performance because you're querying 2 times the same thing). Second, you're saving your post as draft status and querying post with status publish


-1

I found out the problem. i used wp_update_user to create the user, instead of wp_create_user. my bad :/



Top 50 recent answers are included