How can we use default wordpress text editor for my wordpress plugin.Any suggections please?
The WordPress Text editor is an application of the TinyMCE Editor. You can utilize the files located in wp_includes/js/tinymce and create an instance of the editor on your own, according to the documentation.
Check out this article for example instructions:
http://wordpress.org/support/topic/how-i-can-use-tinymce-for-my-own-plugin
As of Wordpress 3.3 the_editor has deprecated in favor of wp_editor. wp_editor uses the new media uploader and takes advantage of all the new features of Wordpress 3.5.x Documentation here: http://codex.wordpress.org/Function_Reference/wp_editor
A very good example of how to use it can be found at Wptuts+ here: http://wp.tutsplus.com/articles/tips-articles/quick-tip-using-wp_editor/
very easy try this code
it's working
wp_editor( $distribution, 'distribution', array( 'theme_advanced_buttons1' => 'bold, italic, ul, pH, pH_min', "media_buttons" => true, "textarea_rows" => 8, "tabindex" => 4 ) );
Very easy:
<?php wp_editor( $content, $editor_id ); ?>
This will generate a lot of html tags. But the one you will be interested in is the textarea with its name set to $editor_id. So when the form is submitted, you can save that content.
You can find more info here: https://codex.wordpress.org/Function_Reference/wp_editor
Related
After lot of research i got the answer for achieving multiple editors on single page in WordPress that it can be done using tinymce.But i am confused where exactly i need to implement the coding part of tinymce in my custom theme
Thank You
Just add wp_editor function in your custom theme files.
Here is example:
wp_editor( $post_content, $custom_id, $settings = array() );
How do I add a font to the Divi wordPress theme? The font is from fonts.com and is called Vectora. Should I use a plugin or custom code? The site I would like to add it to is stewards.degrootdesign.com
Best approach to override the function in child theme by simply adding this code in child theme and your font will be appear in Divi theme editor.
/*
* Fonts Function for fetching all fonts.
*
*/
if ( ! function_exists( 'et_builder_get_google_fonts' ) ) :
function et_builder_get_google_fonts() {
$google_fonts = array(
'customfontname' => array(
'styles' => '400',
'character_set' => 'latin',
'type' => 'sans-serif',
),
);
return apply_filters( 'et_builder_google_fonts', $google_fonts );
}
endif;
Late answer - but I'll bet it's helpful to someone as i still couldn't find an answer to this anywhere today:
To add a custom font to the Divi theme (i'm on V3) font selector dropdowns, you'll need to follow the following steps:
Add your webfont folder to the Divi theme folder eg:
Divi/webfonts
Then reference it from header.php before the closing head tag eg:
<link rel="stylesheet" href="<?php echo $template_directory_uri; ?>/webfonts/customfontname.css" type="text/css" charset="utf-8">
Now, in both: themes/Divi/includes/builder/core.php and themes/Divi/epanel/custom_functions.php
- find the following line:
$google_fonts = array(
and add your font after it, as per the other fonts listed - eg:
'customfontname' => array(
'styles' => '400',
'character_set' => 'latin',
'type' => 'sans-serif',
),
This worked a charm for me. The font should be usable and also should appear in the Font selection dropdowns in the Divi Editor with the other google fonts.
Note: I know this should be done via a child theme and will be overwritten with a Divi theme update but my php and wordpress-fu is too poor to work out how to manage this just yet.
Divi is a commercial WordPress theme that not everyone has access to, so we don't know the particulars of how the theme is designed; so this is the wrong place to ask, and you should to ask Divi theme support for help. You bought the theme, and support is included in the cost.
Their advice will probably include making a child theme; see Child Themes « WordPress Codex. And/or possibly a plugin to make CSS (and font) changes easy, such as https://wordpress.org/plugins/simple-custom-css/
(Assuming that you have the latest version update of Divi):
Go to Appearance -> Customize -> General Settings -> Typography
You should see what is in the screenshot below. From there you can change the header and body font
:) Hope this helps
Screenshot for Typography
I am facing some problem in WordPress Comments template
In my WordPress I can see the comments template after every post but I don't want to see the headings like you can also use HTML tags.
So how can I remove that lines ?
Simply you need to put this code in comments.php page in you project
check comment_form(); in that page & replace that code with this one
comment_form( array( 'comment_notes_after' => ' ', ) );
I'm created a plugin that replaces a previous plugin I wrote and adds some extra stuff too. I want to create an alert in the settings page of my old plugin with a link to download and install my new plugin and inform them that the old plugin is no longer supported by its developer. Currently, from the plugin page of my admin panel, install links look like this:
http://www.example.com/wp-admin/network/update.php?action=install-plugin&plugin=wptouch&_wpnonce=a8d64aa295
It seems to me there are at least two things too keep in mind when creating the URI:
Check whether or not this is a multi-site setup
Make sure I generate the correct nonce.
Does anybody know how to properly do this? Is there anything else I need to consider when generating this URI?
Thanks in advance for your help.
I've found an answer. In wp-admin/import.php, there's a great example of how this work.
Here is my implementation:
$plugin_name = 'my_plugin_name';
$install_link = 'Install ' . $plugin_name . '';
Then just output that link tag anywhere in your admin pages.
If you want to get fancy and add the thickbox modal window effect, just use the function add_thickbox() and attach it to an action that's called in a typical admin request, such as:
add_action('admin_menu', 'my_plugin_add_thickbox');
function my_plugin_add_thickbox() {
add_thickbox();
}
That should do it!
$action = 'install-plugin';
$slug = 'akismet';
wp_nonce_url(
add_query_arg(
array(
'action' => $action,
'plugin' => $slug
),
admin_url( 'update.php' )
),
$action.'_'.$slug
);
Use this. I found this and I am sure it will work.
I would love to kinda replicate WordPress post/page text editor (Admin panel) in comments section. That's how site users will be able to format text easily. A good example of what I actually need can be found here at StackOverflow when someone is about to Ask Question.
In your functions.php, add the following snippet:
add_filter( 'comment_form_defaults', 'tinymce_comment_4265340' );
function tinymce_comment_4265340 ( $args ) {
ob_start();
wp_editor( '', 'comment', array('tinymce') );
$args['comment_field'] = ob_get_clean();
return $args;
}
It's working on WordPress 3.5 and Twenty Twelve theme.
The TinyMCEComment WordPress plugin could help you out. It uses the internal TinyMCE editor (bundled in WordPress 2.0 and up).
Try this tutorial. It worked for me. The above answer might add TinyMCE to the reply section. The tutorial shows how to fix that.