Select Menu
  • Home
  • Wordpress
  • Blogspot
  • SEO
  • Online Earning
  • About Us
  • Contact Us
  • Sitemap
  • PrivacyPolicy
  • About Us
  • Contact Us
  • Sitemap
  • Privacy Policy
Pressspot - Wordpress, Blogspot Coding And SEO Tutorial
  • Home
  • Wordpress
  • Blogspot
  • SEO
  • Earning
Home wordpress Create dynamic sitemap for wordpress without any plugins!!

Tuesday, 10 April 2018

সিহাব সুমন

Create dynamic sitemap for wordpress without any plugins!!

  সিহাব সুমন      Tuesday, 10 April 2018     wordpress      No comments   
Sitemap is useful thing for any kinds of websites. with sitemap you can show all of your web content in one place and submit easily on search engine. for creating sitemap of your wordpress you can use many plugins but plugin use is not good for wordpress. if you want you can create a nice dynamic sitemap for your wordpress without any kinds of plugins. so for this please follow this instruction very carefully.
1. At first copy below code:
/*
Put the following code in your themes functions.php file
*/
    function get_html_sitemap( $atts ){

            $return = '';
            $args = array('public'=>1);

// If you would like to ignore some post types just add them to the array below
            $ignoreposttypes = array('attachment');

            $post_types = get_post_types( $args, 'objects' );

            foreach ( $post_types as $post_type ) {
                if( !in_array($post_type->name,$ignoreposttypes)){
                    $return .= '<h2>' . $post_type->labels->name.'</h2>';
                    $args = array(
                        'posts_per_page'   => -1,
                        'post_type'        => $post_type->name,
                        'post_status'      => 'publish'
                    );
                    $posts_array = get_posts( $args );
                    $return .=  '<ul>';
                    foreach($posts_array as $pst){
                        $return .=  '<li><a href="'.get_permalink($pst->ID).'">'.$pst->post_title.'</a></li>';
                    }
                    $return .=  '</ul>';
                }
            }

        return $return;
    }
    add_shortcode( 'htmlSitemap', 'get_html_sitemap' );
2. now paste it in your wordpress blogs current themes 'functions.php' file and save it.
3. Now create a new page named 'sitemap' in your wordpress blog and at content area paste this small code:
[htmlSitemap]
any problems copy code here
4. Now publish yor page.
for clear understanding see this picture:

You done this!!! now visit your created 'sitemap' page. there you will look nice sitemap created.
Share This Post
Tweet Share Share Share Share Share

0 comments:

Post a Comment

Comments here

Popular Posts

  • How to add autoplay background music on blogger blog.
    We know that blogger or blogspot is a favorite blogging platform for all of bloggers. it is easy to use and free platform. one can easily ...
  • Do you know? how to stop all external request on your wordpress blog?
    At first take my salam, hope all of you are very fine. i am also. wordpress is a number one blogging platform. it is easy to use and manag...
  • Hide 'Screen Option' tab from your wordpress dashboard with some coding !!!
    Hope all of you are very fine. when we visit our wordpress dashboard then we see a tab menu on lef side corner which is named 'Screen O...
  • If your wordpress theme doesn't support 'Menu' you can try this post for 'Menu' support.
    some low quality wordpress theme doesn't support menu. or when a wordpress theme maker create new custom theme then need menu support...
  • Wordpress file upload button or 'add media' button not working? this is the solution!!
    How are you? wish all of you are very fine. im also fine. you know that i always share without plugin post. today i am sharing a nice code ...
  • Remove wordpress logo from admin bar!
    When we visit our wordpress sites admin panel in dashboard. then we see a wordpress logo like this: Which is containing a wordpress logo...
  • How to change default footer text from wordpress dashboard.
    When we enter our wordpress sites dashboard then we see some default text and link like this: which is wordpress related. however, if y...
  • After wordpress install you should be complete 10 tasks.
    You can make a wordpress blog without any kinds of programming knowledge. for dynamic website or blog wordpress is best. my blog is inreac...
  • Stop dragging effect for wordpress metabox without any kinds of plugins!!
    At first take my salam. hope all of you are very fine. when we visit our wordpress sites dashboard, then we see some meta box and if you wa...
  • how to change the permalink in wordpress without plugins ?
    how to change the permalink in wordpress Generally we set wordpress permalink from setting option. but if you try you can set permal...

Contact Form

Name

Email *

Message *

Subscribe to our email newsletter & receive updates right in your inbox.

Blog Archive

Popular Posts

  • How to add autoplay background music on blogger blog.
    We know that blogger or blogspot is a favorite blogging platform for all of bloggers. it is easy to use and free platform. one can easily ...
  • Do you know? how to stop all external request on your wordpress blog?
    At first take my salam, hope all of you are very fine. i am also. wordpress is a number one blogging platform. it is easy to use and manag...
  • Hide 'Screen Option' tab from your wordpress dashboard with some coding !!!
    Hope all of you are very fine. when we visit our wordpress dashboard then we see a tab menu on lef side corner which is named 'Screen O...
  • If your wordpress theme doesn't support 'Menu' you can try this post for 'Menu' support.
    some low quality wordpress theme doesn't support menu. or when a wordpress theme maker create new custom theme then need menu support...
  • Wordpress file upload button or 'add media' button not working? this is the solution!!
    How are you? wish all of you are very fine. im also fine. you know that i always share without plugin post. today i am sharing a nice code ...
click here

Labels

blogspot (1) wordpress (27)

Facebook Fan

BANNER 728X90

মোট পৃষ্ঠাদর্শন

Sparkline

আমার সম্পর্কে

  • সিহাব সুমন
  • itbatayan

Responsive Ads

Responsive Ads Here
Powered by: Blogger
Sitemap | Terms Condition |
Copyright © Pressspot - Wordpress, Blogspot Coding And SEO Tutorial