开发者 | jp2112 |
---|---|
更新时间 | 2015年1月20日 20:38 |
捐献地址: | 去捐款 |
PHP版本: | 4.0 及以上 |
WordPress版本: | 4.1 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
The plugin arguments and default values may change over time. To get the latest list of arguments and defaults, look at the settings page after installing the plugin.
You must have an affiliate account with Studiopress, and a URL that you would use to refer visitors to purchase Scribe.
After going to Settings » WP Scribe Box and inserting your affiliate link, use a shortcode to call the plugin from any page or post like this:
[wp-scribe-box]
You can also use the following function in your PHP code (functions.php, or a plugin):
echo scribe_aff_box();
You can also use this:
do_shortcode('[wp-scribe-box]');
You must define the URL to be displayed. If you do not set the URL in the plugin's settings page, or when you call the shortcode/function, the plugin won't do anything.
You may also use shortcodes within the shortcode, ex:
[wp-scribe-box][my_shortcode][/wp-scribe-box]
And you can specify your own text to be displayed, if you do not want the default text, ex:
[wp-scribe-box affurl="my scribe affiliate link"]Click here to purchase Scribe[/wp-scribe-box]
or
if (function_exists('scribe_aff_box') { scribe_aff_box(array('show' => true, 'affurl' => 'my scribe affiliate link'), 'Click here to buy Scribe'); }
You want to display the Scribe Box at the end of your blog posts, as many affiliates do. Here is one possible snippet:
add_filter('the_content', 'include_scribe_box'); function include_scribe_box($content) { if (is_single()) { // it's a single post // append Scribe box after content if (function_exists('scribe_aff_box') { $content .= scribe_aff_box(); // assume affiliate URL is on plugin settings page } } return $content; }
Always wrap plugin function calls with a function_exists
check so that your site doesn't go down if the plugin isn't active.
For Genesis framework users, use the genesis_after_post_content hook:
add_action('genesis_after_post_content', 'include_scribe_box'); function include_scribe_box() { if (is_single()) { if (function_exists('scribe_aff_box') { echo scribe_aff_box(); // or: scribe_aff_box(array('show' => true, 'affurl' => 'my scribe affiliate link'), 'Click here to buy Scribe'); } } }
This will echo the Scribe box after the post content on each post.
Or you can simply check the "Auto insert Scribe box" checkbox on the plugin settings page and not have to use the shortcode or call the function.
Add this line of code to your functions.php:
add_filter('widget_text', 'do_shortcode');
Or install a plugin to do it for you: http://blogs.wcnickerson.ca/wordpress/plugins/widgetshortcodes/
Now, add the built-in text widget that comes with WordPress, and insert the shortcode into the text widget. See above for how to use the shortcode.
See http://digwp.com/2010/03/shortcodes-in-widgets/ for a detailed example.
Important: If using a widget in the sidebar, make sure you choose one of the smaller images so that it will fit.
Add this to your functions.php:
remove_action('admin_print_footer_scripts', 'add_wpsb_quicktag');
Clear your browser cache and also clear your cache plugin (if any). If you still don't see anything, check your webpage source for the following:
<!-- WP Scribe Box: plugin is disabled. Check Settings page. -->
This means you didn't pass a necessary setting to the plugin, so it disabled itself. You need to pass at least the affiliate URL, either by entering it on the settings page or passing it to the plugin in the shortcode or PHP function. You should also check that the "enabled" checkbox on the plugin settings page is checked. If that box is unchecked, the plugin will be disabled even if you pass the affiliate URL.
Are you using a plugin that minifies CSS? If so, try excluding the plugin CSS file from minification.
The CSS files include a ?ver
query parameter. This parameter is incremented with every upgrade in order to bust caches. Make sure none of your plugins or functions are stripping this query parameter. Also, if you are using a CDN, flush it or send an invalidation request for the plugin CSS files so that the edge servers request a new copy of it.
Add this to your functions.php:
remove_action('admin_head', 'insert_wpsb_admin_css');
Add this to your functions.php:
add_action('wp_enqueue_scripts', 'remove_wpsb_style'); function remove_wpsb_style() { wp_deregister_style('wp_scribe_box_style'); }
If you are using the shortcode, do this:
[wp-scribe-box]Your content here[/wp-scribe-box]
The text output by the plugin will be overriden by whatever you type inbetween the shortcode tags.
If you are using the PHP function, do this:
scribe_aff_box(array('show' => true, 'affurl' => 'my scribe affiliate url'), 'Click <a href="my link">here</a> to buy Scribe');
The second argument of the function is the content you want to use. You can use HTML tags and shortcodes in this string.
This plugin adds one or more toolbar buttons to the HTML editor. You will not see them on the Visual editor. The label on the toolbar button is "Scribe Box".
On the plugin settings page, go to the "Parameters" tab. There is a list of possible parameters there along with the default values. Make sure you are spelling the parameters correctly. The Parameters tab also contains sample shortcode and PHP code.