Trying to count the total number of paragraphs inside a blog article

I’m pretty sure that is_singular() is going to return false when you are inside the WP loop, since there are more than one posts being looped through. Try is_single() or just look at the post object and examine the post_type attribute. add_filter( ‘the_content’, ‘_some_func’, 15 ); function _some_func( $content ) { if( __check_paragraph_count_blog( $content ) … Read more

Insert Latest Articles in Homepage

Edit the home page template and add the following code : <h2>Recent Posts</h2> <ul> <?php $args = array( ‘numberposts’ => ‘1’ ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo ‘<li><a href=”‘ . get_permalink($recent[“ID”]) . ‘”>’ . $recent[“post_title”].'</a> </li> ‘; } ?> </ul> I have used <UL> and <li> to list post…. … Read more

Sitewide page on all the blogs in the network

Guess you’re looking for a post or page broadcaster that can help you push post or page creation and update to your multisite blogs. Give these plugins a try: ThreeWP Broadcast Multipost MU (dead link, mirror at the Internet Archive : Wayback Machine)

Show first sentence of blog post in blog roll

Assuming you want to cut off a string after the first full stop you could use something like this: $the-content = “This is the first sentence. And this is the second”; $cut-in-two = explode(‘.’, $the-content, 2); $first-sentence = $cut-in-two[0];

How to Redirect huge numbers of URLs to another URLs?

If /seba-online-form-fill-up-2018.html is an actual WordPress URL then this is relatively trivial to do in .htaccess. For example, the following one-liner using mod_rewrite could be used. This should be placed before the existing WordPress directives in .htaccess: RewriteRule ^\d{4}/\d{1,2}/(.+\.html)$ /$1 [R=302,L] This redirects a URL of the form /NNNN/NN/<anything>.html to /<anything>.html. Where N is a … Read more

How to change the blog title with add_filter? details below

With the filter single_post_title, you can change the page/post title that is set in the <head><title>Page title</title></head>. If you want to change the title that you see in the page header. ( Which i think you want to do). Use this filter: add_filter(‘the_title’, ‘modify_all_titles’, 10, 2); function modify_all_titles($title, $id) { return ‘SOME TEXT BEFORE TITLE … Read more