Welcome to Praful Bhuskute Black Spy Praful Bhuskute Black Spy Praful Bhuskute Black Spy

Create Shortcode for WordPress Website

Create Shortcode for WordPress Website

				
					<?php

add_shortcode('breadcrumbs', 'breadcrumbs_shortcode');

function breadcrumbs_shortcode()
{
    global $post;
    $post_slug = $post->post_name;

    $breadcrumbs_url = '/article';

    $term_obj_list  = get_the_terms( $post->ID, 'type' );

    $url_string = '
        <a style="color: var( --e-global-color-secondary );" href="/">
            Home
        </a>
    ';

     foreach($term_obj_list as $term) {

        $breadcrumbs_url .= '/'.$term->slug;

        $url_string .= '
            <a style="color: var( --e-global-color-secondary );" href="'.$breadcrumbs_url.'">
            <span class="breadcrumbs-separator">»</span> '.$term->name.'
            </a>
        ';
     }

     $url_string .= '
        <a style="color: var( --e-global-color-primary );">
            <span class="breadcrumbs-separator">»</span> '.$post->post_title.'
        </a>
    ';

     echo $url_string;
}

?>
				
			

Create Shortcode that we need to used in website where we need breadcrumbs

				
					
 <div class="row">
     <div class="md-6">
         

       <div class="search">
           
                     <ul>
                <li>
                <a href="http://prafulbhuskute.com/instamojo-setup-guide/">Instamojo Setup Guide</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/google-workspace-get-a-free-14-day-trial/">Google Workspace get a free 14-day trial</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/get-data-from-database-in-wordpress-to-display-content-in-template/">Get Data from Database in WordPress to Display content in Template</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/how-to-display-different-menu-to-logged-in-users-in-wordpress/">How to Display different Menu to logged-in users in WordPress</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/create-custom-page-template-in-wordpress/">Create Custom Page Template in WordPress</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/create-child-themes-in-wordpress/">Create Child Themes in WordPress</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/how-to-search-specific-text-in-ubuntu/">How to Search specific text in Ubuntu</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/renew-ssl-in-easy-engine-4-ee4/">Renew SSL in Easy Engine 4 (EE4)</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/shortcode-element-always-displaying-at-the-top-of-the-page-wordpress-plugin-issue/">Shortcode Element always displaying at the top of the page WordPress plugin Issue</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/guide-for-magento-2-4-installation-on-ubuntu-cloud-server-aws-ec2/">Guide for Magento 2.4 Installation on Ubuntu Cloud Server AWS EC2</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/important-steps-before-creating-a-website-for-your-client/">Important steps before creating a website for your client</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/best-website-for-gradient-background-css-generator/">Best Website for Gradient Background CSS Generator</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/custom-form-html-to-store-in-database-wordpress-using-page-template/">Custom form HTML to store in database WordPress using Page Template</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/how-to-remove-pages-and-posts-from-search-results-in-wordpress/">How to Remove Pages and Posts from Search Results in WordPress</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/custom-admin-page-in-wordpress/">Custom Admin Page in WordPress</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/3d-card-with-hover-effect-only-using-html-css/">3D Card With Hover Effect only using HTML &#038; CSS</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/create-shortcode-for-wordpress-website/">Create Shortcode for WordPress Website</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/how-to-update-ssl-certificates-in-easyengine-4/">How to update SSL Certificates in EasyEngine 4</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/create-custom-post-type-in-wordpress/">Create Custom Post Type in WordPress</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/how-to-install-easyengine-on-linux-2021/">How to Install EasyEngine on Linux 2021</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/how-to-increase-disk-space-in-ubuntu-server/">How to increase Disk space in Ubuntu Server</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/file-permissions-for-wordpress-installation/">File Permissions for WordPress installation:</a>
               
            </li>
                    <li>
                <a href="http://prafulbhuskute.com/easy-engine-4-commands/">easy engine 4 Commands</a>
               
            </li>
        </ul>
      
            <form action="#">
                <input type="text"
                    placeholder=" Search Courses"
                    name="search">
                <button>
                    <i class="fa fa-search"
                        style="font-size: 18px;">
                    </i>
                </button>
            </form>
        
    
        </div>
    </div>
      
     </div>
     
 </div>

				
			

Drop your queries

Table of Contents

Have A Project In Mind? Let's Get To Work