Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • 					<?php
    					$snippetCount = 0;
    				    $post_snippets = get_option( 'post_snippets_options' );
    				    foreach ($post_snippets  as $snippet )

    Thanks David!

    You’re an absolute legend! Disabling the cache did the trick. Thanks for your help and for creating such a great plugin (without bloat, ads etc too!)

    Right okay, I’ll take a look at counting wordpress options dynamically. Is there an option name like post_snippets or something? To put me on the right track?

    I’m making a template that I will be using for turnkey website clients so it needs to be dynamic.

    I’m assuming you’ll be changing over to a custom post type, which will be awesome!

    I appreciate your help so much but I simply cannot get this to work! I added it into my functions.php file. As you have it posted, I couldnt get it to work. I tried modifying it a bit to see if I could make it work but still to no avail, my sitemap.xml file looks the same as before with pages only, no tax terms.

    Thanks again for your time Sybre!

    Hey there Sybre! I absolutely love your plugin by the way.

    I’ll show you what I am using currently to add a whole new sitemap with all the terms from a certain taxonomy ‘state’. Im not sure how to do the same thing with the snippet you’ve provided above.

    add_action( "edit_term", "create_sitemap" );
    function create_sitemap() {
        $terms = get_terms( array(
        'taxonomy' => 'state',
        'hide_empty' => false,
        ) );
        $sitemap .= '<?xml version="1.0" encoding="UTF-8"?>' . '<?xml-stylesheet type="text/xsl" href="' . 
            esc_url( home_url( '/' ) ) . 'sitemap.xsl"?>';
        $sitemap .= "\n" . '<urlset xmlns:xsi="" xsi:schemaLocation="" xmlns="">' . "\n";
        foreach( $terms as $term ) {
            $sitemap .= "\t" . '<url>' . "\n" .
                "\t\t" . '<loc>' . get_term_link( $term->term_id ) . '</loc>' .
                "\n\t\t" . '<changefreq>Weekly</changefreq>' .
                "\n\t\t" . '<priority>0.9</priority>' .
                "\n\t" . '</url>' . "\n";
        $sitemap .= '</urlset>';
        $fp = fopen( ABSPATH . "location-sitemap.xml", 'w' );
        fwrite( $fp, $sitemap );
        fclose( $fp );

    I get this: which is doing the trick at the moment! It would be nice to have it all in one sitemap file though.

Viewing 5 replies - 1 through 5 (of 5 total)