Created
August 27, 2013 13:59
-
-
Save nashvillegeek/6353895 to your computer and use it in GitHub Desktop.
Wordpress Multisite switch blog and get archive Sublime Text 2 snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
/* <?php */ | |
global \$switched; | |
switch_to_blog(${1:1}); //input blog to switch to | |
// Get latest Post | |
\$latest_posts = get_posts('category=${2:-3}&numberposts=${3:5}&orderby=${4:post_name}&order=DSC'); | |
?> | |
<ul> | |
<?php foreach(\$latest_posts as \$post) : setup_postdata(\$post);?> | |
<li><a href="<?php the_permalink(); ?>" title="<?php echo \$post->post_title; ?>"><?php the_post_thumbnail(); ?></a> | |
<a href="<?php the_permalink(); ?>" title="<?php echo \$post->post_title; ?>"><?php echo \$post->post_title; ?></a> | |
<p><?php the_excerpt(); ?></p> | |
</li> | |
<?php endforeach ; ?> | |
</ul> | |
<?php restore_current_blog(); //switched back to main site | |
/* ?> */ | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>wpswitchtoblogpost</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<!-- <scope>source.python</scope> --> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment