Display multiple custom post types and sort them chronological by one of their fields

There is no output for this sample code because the IF statement you used will never return true, since the string ‘post_type’ will never be equal to any other string but ‘post_type’. Use get_post_type(): if ( get_post_type() == ‘eventtype1’ ) { To order by a date custom field, you will need to use the same … Read more

ACF gallery hook?

You can use the same filter, just replace the type: add_filter(‘acf/update_value/type=gallery’, ‘my_acf_update_value’, 10, 3); All fields extend the same base class, so they also share the same basic filters.

Rewrite WordPress URL to show CPT meta field data

The post type query var is the same as the post type slug by default. Untested, but this should work- function custom_rewrite_basic() { add_rewrite_rule( ‘^books/([^/]+)/([0-9]+)/([^/]+)/?’, ‘index.php?books=$matches[1]&chapter=$matches[2]’, ‘top’ ); } add_action(‘init’, ‘custom_rewrite_basic’); $matches[3] will contain the chapter slug, but if you don’t need that to retrieve the chapter, then you don’t have to set it. Rewrite … Read more

Sorting posts by season

Probably the most “WordPress-y” approach to such a problem is to store the date of your ‘event’ custom post-type in the post’s metadata. Enabling users to set meta-data on a post is usually accomplished by using the ‘register_meta_box_cb’ argument to the register_post_type() function to add an extra “meta box” interface to the pages for creating … Read more

random p tag in advanced custom fields?

The problem is with WordPress’s wpautop() filter. Here’s what ACF says to do: https://support.advancedcustomfields.com/forums/topic/removing-paragraph-tags-from-wysiwyg-fields/ This is a normal WP behaviour – to turn all new lines into paragraph tags. To remove this, you can try loading the value without any formatting. You can do this by providing a ‘false’ for the format parameter in the … Read more

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