Sanitize title only if only custom post type

you want to sanitize the title or the post_name (slug)? if you want to filter post_name you can check wp_unique_post_slug filter or you can use the wp_insert_post_data filter to filter all post data before insert or update in db. add_filter( “wp_unique_post_slug”, “url_sanitizer”, 10, 4 ); function url_sanitizer( $slug, $post_ID, $post_status, $post_type ) { // get … Read more

Modify link options when hovering over post title

If you want to just hide the link in the admin area, you can add this CSS code to your admin area. Assuming that the extra link is the LAST one in the row, add this code to you theme’s functions.php file: add_action(‘admin_head’, ‘my_custom_fonts’); function my_custom_fonts() { echo ‘<style>.row-actions span:last-child {display:none} </style>’; This will hide … Read more

Front page displays different than all other pages?

I’m not very sure how is your title on other pages, but here is how you can modify your title: <?php wp_title( ‘|’, true, ‘right’ ); ?> This will show your Blog’s name right to your page’s title, which will have seo benefits. The | separator will be used here. If you want to customize … Read more

How can I insert a shortcode in the title tag of another?

No, you can’t do that, as the title argument is passed as a string. Given the information you provided, I suppose that your [dt_fancy_title] shortcode does not actually execute shortcodes. The syntax for this function should be: function dt_fancy_title_callback( $params, $content = null ) { // extract the title argument from the params, setting default … Read more

Split site title and apply different classes

Figured it out! function split_title($title) { $title = get_bloginfo(‘name’); $word = substr($title, 0 , 5); $press = substr($title, 5); $html = “{$word}<span class=”bold”>{$press}</span>”; return $html; } And then <?php echo split_title($title); ?>

How to give titles to custom post type as “unique” incremental number?

The method for increment you used will not achieve what you want to if you delete the posts. Instead you can save the counter in wp_options table on front-end form submission, something like: if(get_option(‘customers_count’)){ $count = get_option(‘customers_count’, true); update_option(‘customers_count’, $count+1); } else { /** This will automatically add the option if it does not exist. … Read more

WP_Query by keyword OR post tag

Depending what you want to achieve, the most simple way taken from WordPress documentation looks like below. Displays posts tagged with “bob”, under “people” custom taxonomy: $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘people’, ‘field’ => ‘slug’, ‘terms’ => ‘bob’, ), ), ); $query = new WP_Query( $args ); Check … Read more