DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

PHP Snippet For Grabbing The Page Slug In Word Press

01.09.2011
| 2229 views |
  • submit to reddit
        // php snippet for grabbing the page slub - part of monoslideshow example

// <?php if(is_page("training") || is_page("tech") || ) { ?>
            <? function the_slug() {
            $post_data = get_post($post->ID, ARRAY_A);
            $slug = $post_data['post_name'];
            return $slug; } ?>
            
            <script type="text/javascript" src="/pathto/swfobject.js"></script>
            <script type="text/javascript">
            var flashvars = {dataFile: "/monoslideshow/<? echo the_slug(); ?>.xml",showLogo: "false",showRegistration: "false"};
            var params = {};
            var attributes = {};
            
            swfobject.embedSWF("/monoslideshow/<? echo the_slug(); ?>.swf", "flashContent", "480", "360", "10", false, flashvars, params, attributes);
            </script>
        <?php } ?>