Replacing the title in admin list table

1. Change post title in post list column I misunderstood what you wanted – obviously. You can do that like this: add_action( ‘admin_head-edit.php’, ‘wpse152971_edit_post_change_title_in_list’ ); function wpse152971_edit_post_change_title_in_list() { add_filter( ‘the_title’, ‘wpse152971_construct_new_title’, 100, 2 ); } function wpse152971_construct_new_title( $title, $id ) { //print_r( $title ); //print_r( $id ); return ‘new’; } Making use of the admin_head-$hook_suffix … Read more

Remove “-2” from a Toolset Types URL with the same post name

It can be done by using the request filter. Something like this function alter_the_query($request) { return array(‘page’ => 1, ‘pagename’ => null); } add_filter(‘request’,’alter_the_query’); Here it forces display of post 1, though of course you will want to do a query to determine the ID. For that, it might prove easiest to first parse the … Read more

Adding a span when custom post type is updated

No, you’re right. This is the code that is responsible for ‘New’ span: <?php if (strtotime($post->post_date) > strtotime(‘-14 days’)): ?> <div class=”new-job-tag”><span>New</span></div> <?php endif; ?> The only problem with your modification is that there is no field called the_modified_date in WP_Post object. The proper name of that field is post_modified, so your code should look … Read more

Enabled Revisions to existing custom post type not working WordPress

$cap_type=”post”; $plural=”Products”; $single=”Product”; $cpt_name=”products”; $opts[‘supports’] = array( ‘products’, ‘title’, ‘editor’, ‘thumbnail’, ‘author’, ‘revisions’ ); $opts[‘can_export’] = TRUE; $opts[‘capability_type’] = $cap_type; $opts[‘description’] = ”; $opts[‘exclude_from_search’] = FALSE; $opts[‘has_archive’] = TRUE; $opts[‘hierarchical’] = TRUE; $opts[‘map_meta_cap’] = TRUE; $opts[‘menu_icon’] = ‘dashicons-products’; $opts[‘menu_position’] = 2; $opts[‘public’] = TRUE; $opts[‘publicly_queryable’] = TRUE; $opts[‘query_var’] = TRUE; $opts[‘register_meta_box_cb’] = ”; $opts[‘rewrite’] = … Read more

Custom Post Types – How to include custom fields

@vemuez you need to enqueue js and css files to admin_print_script and admin_print_style here is the example to how to do it // Register datepicker ui for properties function admin_homes_for_sale_javascript() { global $post; if($post->post_type == ‘homes-for-sale’ && is_admin()) { wp_enqueue_script(‘jquery-ui-datepicker’, WP_CONTENT_URL . ‘/themes/yourthemename/js/jquery-ui-datepicker.min.js’); } } add_action(‘admin_print_scripts’, ‘admin_homes_for_sale_javascript’); // Register ui styles for properties function admin_homes_for_sale_styles(){ … Read more

get_page_by_title() not returning anything [closed]

You are missing the second parameter in get_page_by_title. See get_page_by_title() reference. When you are testing without explicitly specified $output and $post_type, this function returns the post of type ‘page’ object by default. So you have to return $page->post_parent for patient’s parent page ID: add_filter(‘gform_field_value_parent_id’, ‘parent_id’); function parent_id() { // three parameters here $page = get_page_by_title(‘TESTID’, … Read more

Custom Taxonomy Breadcrumb Navigation

Using your method, I’ve edited it a bit to make it more viable. Here’s the code, below I’ll explain. <ul> <li><a href=”https://wordpress.stackexchange.com/questions/149424/<?php echo home_url(); ?>/projects”>Projects</a></li> <?php $term = get_term_by(“slug”, get_query_var(“term”), get_query_var(“taxonomy”) ); $tmpTerm = $term; $tmpCrumbs = array(); while ($tmpTerm->parent > 0){ $tmpTerm = get_term($tmpTerm->parent, get_query_var(“taxonomy”)); $crumb = ‘<li><a href=”‘ . get_term_link($tmpTerm, get_query_var(‘taxonomy’)) . ‘”>’ … Read more