External link not showing on post but showing on comment
External link not showing on post but showing on comment
External link not showing on post but showing on comment
Moving Posts to a new site and maintaining URLs
Add minimum word count to Excerpt field To enforce a minimum word count for the Excerpt field before the Post status can be changed to pending, we will slightly alter s_ha_dum‘s code. It can be done by filtering wp_insert_post_data: function wcexcerpt($data){ if (!current_user_can(‘edit_others_posts’)) { $num = 5; // minimum word count if (str_word_count($data[‘post_excerpt’]) < $num) … Read more
It is not that hard to enforce a hard limit on results: add_action( ‘post_limits’, function($limit) { $limits = explode(‘,’,$limit); if (isset($limits[1]) && 2000 < $limits[‘1’]) { $limits[1] = 2000; } $limit = implode(‘,’,$limits); return $limit; } ); I would not be surprised if that does not solve your problem though. Just searching over that many … Read more
In database, it stores the date details with prefix as _start and _end so you need to change the meta keys accordingly. Please have a look at the below code. <p>Start time details</p> <p>Date: <?php echo get_post_meta($post->ID, ‘_start_day’, true);?>.<?php echo get_post_meta($post->ID, ‘_start_month’, true);?>.<?php echo get_post_meta($post->ID, ‘_start_year’, true);?></p> <p>Hour: <?php echo get_post_meta($post->ID, ‘_start_hour’, true);?>:<?php echo get_post_meta($post->ID, … Read more
I am working on my blog where I wish to have a archieve for only specific category post. If I understand you, you are doing this wrong. What you want to do is use pre_get_posts to restrict your archives to the one category. Something like this: function restrict_archives_to_cat($qry) { if ($qry->is_main_query() && $qry->is_date()) { $qry->set(‘cat’,5); … Read more
Yes you can. <?php $args = array( ‘theme_location’ => ‘primary’, //change this value with coresponding menu area ‘menu_id’ => ‘main-menu’, //change this value with wanted menu ); wp_nav_menu($args); ?> menu_id is the name of menu created in WP admin>Menus. I create menu with name “Main menu” so I put main-menu there. That menu is connected … Read more
You can hook into before_delete_post and redirect before completing the deletion. add_action(‘before_delete_post’, function($post_id) { // Get custom field $field = get_post_meta( $post_id, ‘key’, ‘true’); // Redirect if field is empty if (!$field) { wp_redirect(admin_url(‘edit.php’)); exit(); } }, 1);
Post being scheduled that shouldnt be schedulded
How to arrange different post categories in template