Changeset 705560
- Timestamp:
- 04/29/2013 06:51:01 PM (13 years ago)
- Location:
- cross-network-posts/trunk
- Files:
-
- 1 added
- 1 edited
-
cnp-get-blogs.php (added)
-
cnp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cross-network-posts/trunk/cnp.php
r704589 r705560 4 4 Plugin URI: http://wordpress.org/extend/plugins/cnp/ 5 5 Description: Gets a post or category that is within another website on the same Wordpress network. Use as shortcode: [cnp blogid=1 postid=1]. More info on attributes on plugin page. 6 Version: 1.0 16 Version: 1.02 7 7 Author: DanielTulp 8 8 License: GPLv2 or later … … 86 86 } 87 87 add_shortcode('cnp', 'GetPostFromBlog'); 88 89 //credits for this piece of code go to http://themergency.com/adding-custom-buttons-to-the-wordpress-content-editor-part-1/ 90 //add a button to the content editor, next to the media button 91 //this button will show a popup that contains inline content 92 add_action('media_buttons_context', 'add_my_custom_button'); 93 94 //add some content to the bottom of the page 95 //This will be shown in the inline modal 96 add_action('admin_footer', 'add_cnp_inline_popup_content'); 97 98 //action to add a custom button to the content editor 99 function add_my_custom_button($context) { 100 101 //path to my icon 102 //$img = plugins_url( 'penguin.png' , __FILE__ ); 103 104 //the id of the container I want to show in the popup 105 $container_id = 'cnp_popup_container'; 106 107 //our popup's title 108 $title = 'Create CNP shortcode'; 109 110 //append the icon 111 $context .= "<a class='thickbox' title='{$title}' 112 href='#TB_inline?width=400&inlineId={$container_id}'> 113 CNP</a>"; 114 115 return $context; 116 } 117 118 function add_cnp_inline_popup_content() { 88 119 ?> 120 <div id="cnp_popup_container" style="display:none;"> 121 <h2>Create a Cross-Network posts shortcode</h2> 122 <p> 123 To display a post or category from another website in your Wordpress Network: 124 <ol> 125 <li>Select whether you want to display a single post or you want to show a set of posts from a category</li> 126 <li>Select from which website in your network you want to display the content from</li> 127 <li>Select the content</li> 128 </ol> 129 </p> 130 <form method="post" action=""> 131 <input type="radio" name="cnp-type" value="post" class="cnp-type" id="cnp-type-post" /><label for="cnp-type-post">Single post</label> 132 <input type="radio" name="cnp-type" value="category" class="cnp-type" id="cnp-type-category" /><label for="cnp-type-category">Posts from category</label> 133 <div class="cnpwizard"></div> 134 </form> 135 136 <script type="text/javascript"> 137 jQuery('.cnp-type').on('click',function(){ 138 jQuery('.cnpwizard').load('<?php echo plugins_url("cnp-get-blogs.php" , __FILE__ );?>'); 139 }); 140 </script> 141 </div> 142 <?php 143 } 144 ?>
Note: See TracChangeset
for help on using the changeset viewer.