PluginProbe
Post Snippets – Custom WordPress Code Snippets Customizer / trunk
Post Snippets – Custom WordPress Code Snippets Customizer vtrunk
4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.1 1.7.2 1.7.3 1.8 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.8.9.1 1.8.9.2 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 All 115 releases
post-snippets / views / help / advanced.php

advanced.php in Post Snippets – Custom WordPress Code Snippets Customizer trunk, at views/help/advanced.php

47 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3 ?>
4
5 <h2><?php _e('Advanced', 'post-snippets'); ?> (<em><?php _e('for developers', 'post-snippets'); ?></em>)</h2>
6
7 <p>
8 You can add constants to wp-config.php or the theme’s functions.php file to control some aspects of the plugin. Available constants to set are:
9 </p>
10
11 <pre><code>// Allow users with edit_posts capability access to the Post Snippets admin.
12 define('POST_SNIPPETS_ALLOW_EDIT_POSTS', true);
13
14 // Disable PHP Execution in snippets, and removes the options from admin.
15 define('POST_SNIPPETS_DISABLE_PHP', true);
16 </code></pre>
17
18 <p>
19 <?php _e('You can retrieve a Post Snippet directly from PHP, in a theme for instance, by using the PostSnippets::getSnippet() method.', 'post-snippets'); ?>
20 </p>
21
22 <h2><?php _e('Usage', 'post-snippets'); ?></h2>
23 <p>
24 <code>
25 &lt;?php $my_snippet = PostSnippets::getSnippet( $snippet_name, $snippet_vars ); ?&gt;
26 </code></p>
27
28 <h2><?php _e('Parameters', 'post-snippets'); ?></h2>
29 <p>
30 <strong>$snippet_name</strong><br/>
31 <?php _e('(string) (required) The name of the snippet to retrieve.', 'post-snippets'); ?>
32 <br/><br/>
33 <strong>$snippet_vars</strong><br/>
34 <?php _e('(string) The variables to pass to the snippet, formatted as a query string.', 'post-snippets'); ?>
35 </p>
36
37
38 <h2><?php _e('Example', 'post-snippets'); ?></h2>
39
40 <pre><code>// Use querystring for variables
41 $mySnippet = PostSnippets::getSnippet('internal-link', 'title=Awesome&url=2011/02/awesome/');
42 echo $mySnippet;
43
44 // Use array for variables
45 $mySnippet = PostSnippets::getSnippet('internal-link', array('title' => 'Awesome', 'url' => '2011/02/awesome/');
46 echo $mySnippet;</code></pre>
47