wordpress breadcrumbs without wordpress plugin

Breadcrumbs are very common requirement of any wordpress sites. Many clients demands for breadcrumbs for there website. There are many many wordpress plugins available for breadcrumbs but I suggest not to use the wp plugin for breadcrumbs. Because these plugin will add the extra sql queries and load to your website.

All pages are linked for easy backwards navigation. Typically this is placed near the top of a web page. So for example, if you look to the top of this page you will see the breadcrumb navigation menu that leads a path back to the homepage.

wordpress breadcrumbs without wordpress plugin

How to create the breadcrumbs in wordpress
How to create the breadcrumbs in wordpress

Here’s ready code snippet to add wordpress breadcrumbs without wordpress plugin to your WordPress blog. Open your functions.php which you can find in your wordpress theme folder. and then just copy paste the code below in it:

function the_breadcrumb() {
echo '<ul id="crumbs">';
if (!is_home()) {
echo '<li><a href="';
echo get_option('home');
echo '">';
echo 'Home';
echo "</a></li>";
if (is_category() || is_single()) {
echo '<li>';
the_category(' </li><li> ');
if (is_single()) {
echo "</li><li>";
the_title();
echo '</li>';
}
} elseif (is_page()) {
echo '<li>';
echo the_title();
echo '</li>';
}
}
elseif (is_tag()) {single_tag_title();}
elseif (is_day()) {echo"<li>Archive for "; the_time('F jS, Y'); echo'</li>';}
elseif (is_month()) {echo"<li>Archive for "; the_time('F, Y'); echo'</li>';}
elseif (is_year()) {echo"<li>Archive for "; the_time('Y'); echo'</li>';}
elseif (is_author()) {echo"<li>Author Archive"; echo'</li>';}
elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "<li>Blog Archives"; echo'</li>';}
elseif (is_search()) {echo"<li>Search Results"; echo'</li>';}
echo '</ul>';
}

Once done, open your header.php file which you can find in your theme folder and call the above function:

<?php the_breadcrumb(); ?>

how to inject html code into wordpress head

Question, how to inject html code into wordpress head section If you don’t want plugin then use code snippet for inject the code into wordpress head section.

how to inject html code into wordpress head

Many wp developers asked me same question multiple times. How to push the some HTML code into the wordpress head section. It is quite easy to push or inject the the some HTML code into the head section.There are multiple WP plugins which are giving this facility the push the HTML code into the head section. If you don’t want to use the WP plugin then you can use my code snippet for inject the code into wordpress head section.

If you are WP theme developer then you can use following code.

 function WPAPI_init() {
echo "YOUR_HTML_GOES_HERE";
if (is_admin()) {
echo "YOUR_HTML_GOES_HERE";
}
 }
 add_action('wp_head', 'WPAPI_init');

You need to put above code into functions.php file which you find in themes folder.

If you are WP plugin developer then you can put above code into your plugin file.

How to display attached images of posts

Many times people create bigger post or article. Many wp developers asks me many questions daily. Most commonly I asked about showing the all the post images as slide show or only thumbs. Using following code you can fetch the wordpress thumbnails. You just need to put following code into your functions.php file.

How to display attached images of posts

Using following code you can display attached images of posts. You just need to put following code into your functions.php file and you will be done.

functions.php file you can find in your wordpress theme folder. Put following function in that file.

function show_all_thumbs() {
global $post;
$post = get_post($post);

/* image code */
$images =& get_children( 'post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent='.$post->post_parent);
if($images){
foreach( $images as $imageID => $imagePost ){

unset($the_b_img);
$the_b_img = wp_get_attachment_image($imageID, 'thumbnail', false);
$thumblist .= '<a href="'.get_attachment_link($imageID).'">'.$the_b_img.'</a>';

}
}
return $thumblist;
}

In index.php or single.php you can use following code.

<?php echo show_all_thumbs(); ?>

Using above code you will be able to show or display all the attached images of the posts.

How to create pages programmatically in wordpress

Creating the pages by using script or in wordpress is very easy. You just need to the following code snippet for create pages programmatically in wordpress. Many times we need to create the default page or post in wordpress. You just need to the following code snippet in functions.php file or your can put following code in your plugin file.

create pages programmatically in wordpress

If you are the wordpress plugin or theme developer then following code sample is rally useful to create the empty post or page in wordpress.

global $user_ID;
$page['post_type']    = 'page';
$page['post_content'] = 'Put your page content here';
$page['post_parent']  = 0;
$page['post_author']  = $user_ID;
$page['post_status']  = 'publish';
$page['post_title']   = 'Your Page Title';
$page = apply_filters('yourplugin_add_new_page', $page, 'teams');
$pageid = wp_insert_post ($page);

Interlinking Articles on WordPress

SEO on WordPress is not that difficult. There are DIY blogs and articles that will help to teach you the best ways to use SEO on your WordPress sites. You can learn all about the newest SEO strategies that work the best, and some tried and true strategies that may not be as much on the cutting edge, but that can still help your site.

Interlinking Articles on WordPress

Interlinking Blog Posts Properly

If you are looking for your WordPress site to rank higher in the results of searches, you will tweak your category pages. However, it is also necessary to link new articles to relevant older articles. You need to know how they should be linked, which ones should be linked and what anchor text should be used.

Load Google Analytics

Check your current keywords, to see what articles of yours are already ranking in search engines. If your articles don’t rank #1 for any of your traffic keywords, be sure you link to those older articles from your new writings. It is easier to make improvements on existing rankings than it would be to rank for something new.

Interlinking Articles on WordPress
Interlinking Articles on WordPress

Before You Interlink…

There are SEO nuances that affect the way you should interlink. These are not secrets, but they are the way top SEO users believe that search engines currently work. Links higher up in their HTML will pass more “search juice”. This simply means that if your links are above the fold, close to the top of the page, they are more important than links buried lower in your articles. Keep your links close to the top or middle of your article.

Interlink One Page One Time

The best way to attract top search engine results is by only interlinking each page once, despite the temptation to link more than one time to each page. You can acquire links this way, too. If you work smart, you won’t have to add any new text to your existing posts. You can just find the keywords already in those posts and hyperlink to them.

Links – Automatic or Manual?

Some posters prefer to do their links manually, and others use programs like ScribeSEO. ScribeSEO will recommend where you link and what you link, as well. Doing links manually allows you to fine tune the SEO based on your current data and your rankings now. If you use an automatic program, you could miss some opportunities.

The Best Ways to Link

From the standpoint of marketing, if you are trying to get clicks to specific pages on your WordPress site, you can link to it more than once. Interlinking allows linking of old posts to new, and newer readers can learn about the older posts, which they may find interesting. It will also help in decreasing your blog’s bounce rate. This is more helpful for SEO purposes, too.

Thesis

Thesis is one of the better premium WordPress themes, and also a community of people who are all dedicated to the goal of building better sites. The members of the forum have a lot of helpful advice for people who are newer to the blogging scene.

Helping Search Engines

If you want search engines to rank every page on your blog, then they must be able to find every page. The bots or spiders used by search engines trawl online and index web page content. If you use interlinking on your blog, this makes it easier for spiders to index each page of your WordPress blog.

Google Looks at Every Page

Google ranks website pages in part on how many other pages are linked to it. This means how many pages, not how many sites. When you interlink your blog entries, you’ll help each article to earn a better search ranking, and it will bring more traffic.

Add javascript to wordpress through plugin

You can add the any javascript through theme. But some times many clients wants simple wordpess plugin which will inject javascript code into wordpress site.  Here we have simple wordpress plugin code which Add javascript to wordpress through plugin and inject the javascript tag into head section of wordpress site.

Add javascript to wordpress through plugin

Here I will give very simple wordpress plugin code which inject the javascript tag into head section of wordpress site. You need to use my following code for creating the wp plugin. Create file with”wpapi_js.php” name and put following code in to that file.

Put this file under wp-content/plugins folder. Go to admin bashboard, plugin section. You will able to see the wpapi_js Ads plugin over there. After activating the plugin you will find. Javascript file will be added into head section.

<?php

/*

Plugin Name: wpapi_js Ads

Plugin URI: http://www.purabtech.in/

Description: wpapi_js Ads Plugin will add the ad slot to wordpress site

License: GNU General Public License 2.0 (GPL) http://www.gnu.org/licenses/gpl.html

Version: 1.0

Author: Purab Kharat

Author URI: http://www.wordpresapi.com/

*/

if ( !defined('wpapi_js_AD') ) {

define('wpapi_js_AD',get_option('siteurl').'/wp-content/plugins/'.plugin_basename(dirname(__FILE__)).'/');

} else {

define('wpapi_js_AD',WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__)).'/');

}

function wpapi_js_init() {
 if (!is_admin()) {
 wp_enqueue_script('the_js', 'http://yourjspath.com/test.js' );
 }
}
add_action('init', 'wpapi_js_init');

?>

If you want to add the javascript script for only wordpress admin panel then use following code.

 

//Load script to admin panel
function admin_myplugin_load_js(){
 wp_enqueue_script( 'custom_js', plugins_url( '/js/myplugin.js', __FILE__ ), array('jquery') );
}
add_action('admin_enqueue_scripts', 'admin_myplugin_load_js');

api-wp-css-js

Using above code you can easily Add javascript to wordpress through plugin, website to wp admin panel. Use above code and enjoy!

WordPress Got Some Key Updates For Android

WordPress for Android Got Update – Superb Media Handling, Improved Gallery Support & Better Stats. Finally on this week, WordPress Got Some Key Updates.

WordPress Got Some Key Updates For Android

WordPress for Android Got Update – Superb Media Handling, Improved Gallery Support & Better Stats

Finally on this week, the most important WordPress Android application has received some major updates that make it easy and simple to post on the go. Across the world, there are lots of android users, who have gone through many different stages, but this major update brings an excellent and the most stunning mobile experience to Android users so far.

WordPress Got Some Key Updates For Android
WordPress Got Some Key Updates For Android

WordPress android app update got one of the best and most exciting updates, which has enhanced and boost support for media, gallery, theme browser, native stats, pin lock and more. If you want to get complete information about the update, continue reading this blog that contains details information about the each feature updates. Let’s have a look:

Wonderful Support for Media Library & Gallery:

Now, users can easily access to any files in their media library and can easily edit title, description and caption for any item. Chances are very high that you can include various pictures and videos when you are blogging on the go.
This application is going to provide a much smoother experience for uploading pictures, videos and other stuff from your smart-phone to the media library. In the launch of update, the gallery support has blown the mind of various people.
Using a long-press to choose multiple media items, creating tiled galleries is extremely easy and tapping the gallery to develop a new gallery. Users of this application can also choose a gallery style and even reorder button to develop a new gallery as per their requirements.
Along with it, you are also able to select gallery style and even reorder the images with drag and drop facility. Further, the WordPress android app update is considered a big update to the application as it makes posting and administration a lot simpler and beautiful.

WordPress.com Theme Browser:

Are you running a WordPress.com blog? If yes, theme browser enables to browse, preview and activate a new theme for your website using your device. If you are looking for specific theme and theme feature, you can easily head to the Themes menu in the navigation drawser, search using the ActionBar and you can see results very quickly.

Securing Content with advanced Pin Lock feature:

After the update, WordPress Android application comes with a new feature in the setting menu, where users can see a Pin Lock. Using Pin Lock, users can get help to protect and secure their content from any kind of problem and from any random Joe, who might be getting access to your phone.
By enabling this feature, you are able to protect your content using PIN. You need to enter the PIN to unlock the application, so all the WordPress users can take benefit of this feature and keep their content safe.
Another very interesting thing that you can find in Pin lock is Automattic that has made the code open source and obtainable on github. Developers can easily drop this functionality into another application as well.

Stats Updated with faster and native support:

Finally, “stat” has been revamped with much faster version. Now, users don’t have to use an old web-based version as it has been updated with native support as well. To review key stats at a glance, users are able to use filters in the ActionBar. Now, status support comes with all the major information, including:

  • Total, Followers & Shares
  • Referrers
  • Visitors & Views
  • Search Engine Terms
  • Clicks
  • What’s More?

I think these are major and most important updates in the application that allow you to get many new benefits. What’s more you want from WordPress Android app? However, it is also expected that another major update is in the works. As per the spokes person of the company “Expect another big update soon that adds a native WordPress.com Reader, as well as a revamped welcome and blog setup experience.” Well, android users get ready for new update, till dates enjoy this one!
Summary: Recently, WordPress Android application has received some major updates that make it easier than before to post on the go. Now, WordPress android users can easily post anything while they are on road, home or office. In this blog, I have shared complete information about the update, so continue reading it..

Remove short words from wordpress permalink URL

WordPress itself creates the permalink. WordPress permalinks are very important for SEO purpose. Short words are sometimes are not good for seo so you might need to remove the short words from permalink. Using the following code you can remove the short words from wordpress permalink URL.

Using code you can Remove short words from wordpress permalink.

You just need to add the following code functions.php file.

add_filter('sanitize_title', 'remove_short_words');
function remove_short_words($slug) {
 if (!is_admin()) return $slug;
 $slug = explode('-', $slug);
 foreach ($slug as $k => $word) {
 if (strlen($word) < 3) {
 unset($slug[$k]);
 }
 }
 return implode('-', $slug);
}

 

Source Link :wpsnipp.com

 

Get user log history in wordpress

There are many types of users we need to manage in our website. Admin wants to keep log history data in site for future use purpose. Saving log history is important when you have multiple users in wordpress site. In this article I will show you how to Get user log history in wordpress. when you have multiple users in wordpress site. In this article I will show you how to keep the log history of users.

Get user log history in wordpress

Why User Login History is important

Some times there are too many users with different roles in site. It is very hard to check which user is doing what. But you as admin of website want to know about user’s activity. It is important to record all the history of user so you can check which user is performing which actions and when user’s are active in site.

Some times you create multiple moderators in website to review your site content and media. For reviewing the user content user logs are very important so you can easily know about user’s logs. I found very nice wordpress plugin which will help you to keep user log history in wp site.

Simple History (http://wordpress.org/plugins/simple-history/)

Get user log history in wordpress,Get user log history in wordpress
Get user log history in wordpress

Simple History shows recent changes made within WordPress, directly on your dashboard or on a separate page.

The plugin works as a log/history/audit log/version history of the most important events that occur in WordPress.

There are multiple features are given by above wordpress plugin. Simple history plugin has great setting options which will help admin to keep limited user logs on site. It has features to filter user logs as per role.

I personally love this plugin. It has able to record multiple actions of users in wordpress like login, logout, media, upload, wrong password, creating posts or pages in site. There options are really great features of this plugin.

 

WP Login Security and History (https://wordpress.org/plugins/wp-login-security-and-history/)

By this smart plugin you can protect your login page from Brute-force attacks also you can track login history. Features:

  • Captcha on the admin login page to protect against auto-hacking.
  • You can set the number of failed logins to show Captcha or showing it always.
  • Login Blocker option to block the login processe for a period of time after specific number of failed logins.
  • Login history to show all login processes in details.

 

 

Easy Steps To Create WordPress Theme From PSD Images

Website is one of the most imperative platforms which is extensively used by business owners to promote their business at the worldwide level. Thus, creating a website must be taken into contemplation without any compromise. WordPress websites are more admired because of the fact that WordPress websites are very easy to develop and use and it is SEO friendly too. This is the primary reason which is driving people towards WordPress.

steps to create wordpress theme from PSD

Most of the people can craft an image PSD out of their design, but coding is accounted as quite daunting for them. So, there is an easy option for them, that is, they can create their PSD to WordPress themes.
Here, a short guide has been given which will help you to change PSD to WordPress themes:

A brief guide for creating PSD to WordPress themes:

Section 1: Segmenting PSD

The very initial step for converting PSD to WordPress is segmenting the website. This has to be done in such a way that image design file can be sliced into multiple design files. This is very important for creating code for the complete image cannot be done at a single platform. In a website, all these segmented images will be pooled in such a way that each of its components can draw its unique functionality and purpose.

Section 1: Segmenting PSD,steps to create wordpress theme from PSD
Section 1: Segmenting PSD ,steps to create wordpress theme from PSD

Section 2: Drafting Index.html and style.css

Since, you have now got the sliced images so, the next thing you need to do is to code those images into HTML and XHTML format by making use of HTML and CSS. Developers are having a plethora of alternatives for doing this, as they are having software like Fireworks and Dreamweaver.

Section 2: Drafting Index.html and style.css ,steps to create wordpress theme from PSD
Section 2: Drafting Index.html and style.css,steps to create wordpress theme from PSD

The main purpose of coding the images in HTML and CSS format is to affix the entire rollover effects along with pixel placement.

Section 3: Split index.html as per WordPress theme file structure

The complete procedure of developing a custom WordPress website refers to creating a WordPress theme which has to be uploaded to appropriate software. Using WordPress tools and plugins, various functionalities are added to the WordPress theme after converting it from PSD.

Section 3: Split index.html as per WordPress theme file structure
Section 3: Split index.html as per WordPress theme file structure

So, in order to accomplish your exact requirement in aspect of WordPress website, it needs to be considered that design for HTML file must be done according to WordPress theme’s file structure. You can also split your single HTML file into multiple HTML files as per the theme file structure.

Section 4: Engraving WordPress tags

You need not to use any sort of complex HTML codes for introducing hundreds of inbuilt functions which can add various functionalities to the WordPress theme. The simplest thing that you can do is, just put-in WordPress inbuilt function tags in themes files in order to get the enviable functionality. The beauty of WordPress is that it takes care of all such minute issues.

Section 4: Engraving WordPress tags
Section 4: Engraving WordPress tags

Section 5: Accumulating functionalities

The entire magic of WordPress can be seen exactly after the developing and activation process of WordPress. By employing user friendly WordPress dashboard, you either have to configure the existing structure or by installing a plugin, you can add and modify the functionalities of the website.

Section 5: Accumulating functionalities
Section 5: Accumulating functionalities

This evidently means that you no more have to spend your precious time and efforts to change the core HTML code. Moreover, you need not to go through each line to make the theme compatible with other new changes.

Thus, by following these straightforward steps, you can simply obtain a WordPress theme by converting the PSD image into WordPress themes. You can also refer to a range of tutorials also which can elucidate the complete process with an aid of a video.