Thursday, December 24, 2015

Wordpress get permalink of post from ID

Permalink of a page or post using ID can be retrieved as follows:

$url = get_permalink($post_id);

Where $post_id  is the ID of the post or page whose permalink is to be get.

Wordpress get acf field value of another post

To get values of ACF field from another page or post use the following method.

$value = get_field('field_name',$post_id);

Here $post_id  is of another post or page whose ACF value you want to fetch in the current page or post.

Wednesday, December 23, 2015

Wordpress site url

To get the website URL use the following inbuilt function of WordPress.

$site_url  = site_url();

You will value of site URL in the above variable and can be used as following:

<?php echo $site_url; ?>

Wordpress home url

As we know WordPress is a very powerful blogging open source CMS, so is development easy and flexible.

To get the home page URL use the following function.

$home_url = home_url();

<?php echo $home_url; ?>

You will get the home URL in the above variable.

MS SQL : How to identify fragmentation in your indexes?

Almost all of us know what fragmentation in SQL indexes are and how it can affect the performance. For those who are new Index fragmentation...