New answers tagged

1

So thanks to Jacob Peattie and his helpful comments I was able to resolve this issue. meta_key was part of the group, but it wasnt prefixed by a group key. So, something like this totally works for me: group_field_sub_field. So changing that in both arrays did the trick.


0

There are a number of ways to go about solving something like this. The real problem comes if/when you need to apply default pagination to the query. The best way to handle this, and preserve the ability to paginate, would be to use a combination of meta_query clauses. Jack Johansson was on the right track, this just requires a bit more logic in the query. ...


0

With this code you can search in post list in WordPress Admin Panel with custom post meta values along with title and other default fields. Please, add below code in functions.php file: if (!function_exists('extend_admin_search')) { add_action('admin_init', 'extend_admin_search'); /** * hook the posts search if we're on the admin page for our ...


-1

You need custom post type UI Plugin to create a post type like "posts" Link - https://wordpress.org/plugins/custom-post-type-ui/


1

I don't believe that custom post types are a part of ACF. I use custom post type generators to add post types. This is the one that I use. You would just need to paste the resulting code at the bottom of your theme's functions.php file.


0

This is mostly a opinion based question and perhaps not best suited for WPSE as this is not a discussion forum, but a Q&A one. That said, I'd mostly likely go with a custom post type note which would have the read page as post_parent, user ID as post_author and notes made by the user would go to post_content. There should be only one note per page per ...


1

Double check if your <div id='repeater'> is properly inside <form> tag of your page ( I assume you're in a form since your code does not provide an ajax function) and from what you outpup with var_dump($_POST['al_ttl']) it may be the reason of Undefined index: al_ttl. Also note that you're overwriting the first initialization of $post_id with ...


0

I found this plugin that made my life easier, so I didn't have to code all that https://wordpress.org/plugins/wp-rest-filter/


0

I've spent an hour searching for a solution and there was nothing that works so I had to write the solution on my own. It is tested and working with Wordpress 5.3.1 and is the only solution that solves this problem I could find on the internet. Place the following code in your functions.php file to hook into posts_clauses filter. /** * Include meta ...


1

Thanks! We ran into the same issue and this question helped a lot! Alternate Use Case We're looping through a custom post type called events (surprise, surprise, it stores events). It stores a timestamp in the meta field ev_start (event start time). We actually were able to just use the orderby value meta_value_num (as you can see meta_type is commented out)...


1

It depends on how you added the custom fields. If you used a custom fields plugin, you may be able to call a plugin-specific function. For example, with ACF, you can call get_field('fieldname') to retrieve one specific custom field. If you're not using ACF (or even if you are), as long as your fields are stored as postmeta, you can do something like <?...


0

Thank you for your answer, but when I test nothing displays except the type_partenaires. I think I was wrong on the explanation of my problem. sorry. I would like to be able to sort by the "partners_order" field. this field is in my while after my $loops <?php $terms = get_terms('type_partenaires'); usort($terms, function($a, $...


1

You have to also fetch the value in href attribute as wel. Currently there are static value you have added. when you change value from backend it just display but when you click it will consider tel: and mail: attribute value. So change code as below: Phone: <a href="tel:<?php echo get_post_meta( $post->ID, 'telNo', true );?>"><?php echo ...


1

So finally I found a way to do that. Here is the code. page-contact.php <!-- Contact Info --> <div class="contact-info col-md-4 col-sm-4 margin-top-20 padding-left-20"> <label class="contact-label pull-left width-wide">Contact Info</label> <p><strong>...


0

You have placed orderby in a wrong array. Please check modified code. $loop = new WP_Query( array( 'post_type' => 'partenaires', 'orderby' => 'title', 'order' => 'ASC', 'posts_per_page' => -1, 'paged' => $paged, 'meta_key'=> 'partners_order', 'orderby' => 'meta_value_num', 'order' => 'ASC', '...


1

You have to remove if($post_slug != $post->post_type){} from save function or change $post_slug = "book"; to $post_slug = "page";. because it check $post slug is book or not. currently post type is page for contact us page. and you have set as book add_action("save_post" , "wpl_owt_save_metabox_data" , 10 , 2); function wpl_owt_save_metabox_data($...


2

Currently you can not unset key because you can not find proper key from array. The issue is that you did $stamp = array($_POST['stamp']); as array which is wrong. you have to remove array() from $stamp, so which look like $stamp = $_POST['stamp'];. then you can search value in column from array and unset it. I have tested below code which is working ...


Top 50 recent answers are included