Category Archives: Uncategorized

peragraph

Show first paragraph content

In this article you learn that how you show first paragraph content on page or post
Please check the below code snippet –

$content = apply_filters( ‘the_content’, get_the_content() );

$text = substr( $content, 0, strpos( $content, ‘</p>’ ) + 4 );

$final_text = preg_replace(“/<img[^>]+\>/i”, “”, $text);

echo $final_text;

menu bar

How to add arrow icon in submenu

How to add arrow icon in submenu –

Please copy following code and paste your css file –

.nav-menu .sub-menu li.menu-item-has-children a {
background:url(images/nav_bg.png) 97% center no-repeat;
}
.nav-menu .sub-menu li.menu-item-has-children .sub-menu li a
{
background:none;
}

Please change the class name with your class name and image name with your image name.

cheers -:)

web designing

WordPress excerpt

WordPress Excerpt

WordPress Post excerpt is a short summary of your post. The excerpt has two main use.

  • It replaces the full content of post in RSS Feed.
  • It can be used for Search results, Monthly archives, Author archives etc

The most commonly used method for adding Excerpt to the WordPress post is to use a function in the template.

the_excerpt();

Mostly in a WordPress setup, we have noticed [..] as a symbol of Read More which sometimes doesn’t suites the theme or design of the website. Here we are going to show you some interesting methods to play with WordPress Excerpt.

Changing the Read More text

WordPress provide a Filter Hook for to alter the Read More text. The filter hook simply returns the desired text and replace it with the default. The Filter hook name is excerpt_more. Lets have a look on example code to alter the text.

add_filter( 'excerpt_more', 'rnd_read_more'   );
function rnd_read_more() {
    return 'Read More ยป';
}

Please this code inside the function.php of your active theme or inside the main file of your plugin and we are done with altering the Read More text.

Adding link to Read More

I hope you are still with me and still checking the post. We have just altered the Read More text but the text is simply a text not a link. Which may confuse the users. Now, what if you wanted to redirect the user once they click on Read More >>.

add_filter( 'excerpt_more', 'rnd_read_more'   );
function rnd_read_more() {
    return    '<small>&nbsp;&nbsp;&nbsp;<a href="'.get_the_permalink(get_the_ID()).'">Read More &raquo;</a></small>';
}

The above code will add link to the Read More >>.

Changing the size of Excerpt

Now, it’s time to change the size of the excerpt. WordPress provides an another Filter Hook to change the size of excerpt. The hook named excerpt_length. Below is the code to change the size with this hook.

add_filter( 'excerpt_length', 'rnd_excerpt_limit', 999 );
function rnd_excerpt_limit() {
    return 20;
}
wp-excpert

How to change the footer in your wordpress admin panel

Please copy and paste this code in your theme function.php file –

function remove_footer_admin () {
echo ‘Fueled by <a href=”http://www.wordpress.org” target=”_blank”>WordPress</a> | Designed by <a href=”#” target=”_blank”>XYZ</a> | WordPress Tutorials: <a href=”http://www.wpbeginner.com” target=”_blank”>WPBeginner</a>
‘; }

add_filter(‘admin_footer_text’, ‘remove_footer_admin’);

 

Enjoy, get info here.
cheers -:)

wp-excpert

Finding post basded on post meta value in WP_Query

Rencently I was working on a Custom Post Type plugin under the banner of RND Experts, where the user will enter name of the city and the field will get saved in the wp_post_meta table. The client has request to create a shortcode where we can filter Post on the basis of Single city or Multiple comma seprated cities.

Here is the code I’ve written to accomplish the requirement.

$atts = shortcode_atts( array(
		'city' => '',
	), $atts 
);

$args = array(
		'post_type' 		=> 'wp_property',
		'posts_per_page' 	=> -1
	);

if( $atts['city'] != '' ) {

	$cities = explode( ',', $atts['city'] );
	
	$meta_query = array();
	
	if( !empty($cities) ) {
		foreach ($cities as $key => $city) {
			$meta_query[] = array(
					'key' 		=> 'cptwh_property_city',
					'value' 	=> strtolower(trim($city)),
					'compare' 	=> 'LIKE'
				);
		}
	} 
	$args['meta_query']['relation'] = 'OR';
	$args['meta_query'] = $meta_query;
}

$properties = new WP_Query( $args );

1.Here are the steps to do this.
2.Extract the attribute values. Like, I’ve used city attribute.
3.Now you have to check if users has assigned any value to City attribute. If there is no value we will not process the Meta Query.
4.In case we have found any value in the City. Lets, find the number of cities entered by using explode function.
5.Now parse the exploded string using foreach loop and assign values to a newly created array variable meta_query.
6.Now, after Array element use a ‘relation’ element for comparision method. Default value of ‘relation’ is ‘AND’. If in case you will not provide any value it will find the records which fall under the values. I’ve assigned value OR to this so that I can fetch all the Posts which have the City 1 and City 2 in its meta table.

web designing

Add the class in first p, h2 or any html tag

How to add arrow icon in submenu –

Please copy following code and paste your css file –

.nav-menu .sub-menu li.menu-item-has-children a {
background:url(images/nav_bg.png) 97% center no-repeat;
}
.nav-menu .sub-menu li.menu-item-has-children .sub-menu li a
{
background:none;
}

Please change the class name with your class name and image name with your image name.

cheers -:)

web designing

WooCommerce user orders status report

WooCommerce Plugin for shop reporting

As for now WooCommerce an eCommerce solution for WordPress doesn’t provide any downloadable user wise reporting system. RND Experts is working on this feature and named this plugin WooCommerce User Orders Status Report. The Plugin developers team is doing a great job and will be done soon. The plugin will be released soon with many feature and 24/7 support to the end customers. The user will be able to install and use the plugin very easily.

However, the RND Experts plugin developers team will add more features like Graphs in the next version and more attractive addition to the original plugin. Moreover, users can request changes as per there requirements. The team will be available 24/7 for customization.

Features

  • Independent WooCommerce plugin.
  • User wise reports.
  • Daily, Weekly, Monthly, Yearly reports.
  • Data between two dates.
  • Export to Excel.
  • Reports on the basis of order status.
  • Order status tabs for quick reports.
  • Report logs.
  • Mobile Compatible UI.

Compatibility

The WooCommerce User Orders Status Report plugin is compatible with WordPress 3.5 and above versions.

Tested Upto

The plugin will be tested on the latest version of WordPress and WooCommerce.

Pricing

The plugin has been keep private for now. But, the RND Experts will soon release a affordable price very soon.

More to come-up soon.

web designing

How to avoid “Header already sent issue”?

How to avoid “Header already sent issue” on WordPress plugin or Themes.

It’s been a long time I was fighting with the “Header already sent” issue with our custom WordPress plugin which redirects the users after login to a custom URL i.e. http://rndexperts.com. The plugin was always trowing an error. After making all the changes as per the WordPress recommendations the problem was still there. After some searches and r&d we have found a full proof solution.

By adopting this solution the problem will never occur and you can write your redirect code anywhere without bothering about the “Header already sent issue” or any other buffer issue. You to paste the following code inside your Theme’s function.php or in your main plugin’s file if you are developing a custom plugin.

add_action(‘init’, ‘do_output_buffer’);
function do_output_buffer() {
ob_start();
}

Believe me it’s a great solution. Now you don’t have to deactivate your all the plugin and themes or deleting files from your server. These all are very traditional and sometimes doesn’t work. Being a Plugin developers we know, these all measure never works. Because we know the origin of the error and we also know that we can’t delete our entire work to resolve the issue.

The process of the code is very simple. This code will simply clear the buffer on initialization.

Please write your reviews and comments to help us improving the answer. You can also send us a message to know more about mision web

RND Experts will always be happy to assist you.

Happy Coding!