I have created a subdomain for my website called "hindi.mysite.com" and I want to add the Hindi text "हिंदी" to the site title with tags. I am using the GeneratePress Premium theme and have tried adding the code to the functions.php and header.php files, but it is not working. I have also tried using a GP hook to add the text, but it is still not working. I have also tried adding css but still not working. I have checked for any errors or typos, but haven't found any. I am looking for a solution on how to properly add the Hindi text to the site title with tags using the GeneratePress theme.
I tried adding the following code in the functions.php file, the header.php file, and as a GP hook:
function add_hindi_text() {
echo '<sup>हिंदी</sup>';
}
add_action( 'generate_site_title', 'add_hindi_text' );
I was expecting the Hindi text "हिंदी" to be added to the site title with tags, but it is not showing up.
Related
I'm making a WordPress theme by myself since I'm working for the first time in Wordpress I've watched some tutorials about it.
I have page.php header and footer and ofc an index. I insert the content from the pages with this:
<?php echo get_post_field('post_content', $post->ID); ?>
but I tried the get_post in a while loop with same result..
Everything is fine but when I want to use a plugin I can't add to my page... When I insert the shortcode of it it shows only the shortcode string... There are some plugins where I can click a "view" option and it would show a page with my plugin (for example a calendar) but that page is empty...
When I activate an original theme it works instantly... So I'm sure something is missing from my theme something which can load the plugins but I couldn't find solution for it.
Any ideas?
Did you add the <?php wp_head(); ?> function before the head area of the html document is closing? It imports important scripts and styles from wordpress itself (and probably also from the plugins).
See here:
https://developer.wordpress.org/reference/functions/wp_head/
Before closing the body area, the template should also include
<?php wp_footer();?>
See here:
https://developer.wordpress.org/reference/functions/wp_footer/
I have scoured WordPress, and TinyMCE documentation and stackoverflow and wordpress.stackexchange for an answer to this problem. Right now, I can see NO duplicates to this question.
I want to remove the menubar from a tinymce editor in a WordPress plugin admin page.
I am building a WordPress plugin. As part of the plugin's functionality a user has to add content using TinyMCE. I use wp_editor() which adds a TinyMCE instance to the plugin's admin page.
TinyMCE works fine. I have been able to configure buttons using this answer: https://stackoverflow.com/a/27872094/2298108 . However, this does not help remove or configure the menubar. I have tried adding menubar=>false to the tinymce array.
I've even looked for a frontend hack to access the editor and remove the menubar. Because WordPress instantiates tinymce, I have NO access to tinymce.init(). I have tried using the frontend event addeditor which fires, and gives "access" to the editor, but there doesn't seem to be any method to remove the menubar.
My php inline code:
$settings= ['menubar'=> false,'toolbar1' => 'formatselect,|,bold,italic,underline,|,hr,|bullist,numlist','toolbar2'=>false];
wp_editor($this->form_confirmation,'xxx_form_confirmation_mce',['editor_height'=>200,'media_buttons'=>false,'quicktags'=>false,'menubar' =>false,'tinymce' => $settings]);
$this->form_confirmation is a string and gets added to the content screen of the editor.
NOTE: I am using the "TinyMCE Advanced" WordPress plugin.
You can hook into tiny_mce_before_init to further customize the TinyMCE editor before it gets loaded.
This removed the menu bar for me:
function wp2641_disable_tinymce_menu_bar( $in ) {
$in['menubar'] = false;
return $in;
}
add_filter( 'tiny_mce_before_init', 'wp2641_disable_tinymce_menu_bar' );
I am having a problem with a site I am developing with wordpress.
It happened after upgrading to the latest version (4.7)
Anyway. Go to the site www.scientized.com (just dummy content for now), and go the source. At around line 124 you see the tag <style type="text/css" id="wp-custom-css"> and then after some css is loaded.
The thing is, is that this some of my old css code from way early. To make life easier and to isolate the problem I have delete all css in my child themes style.css as well as the custom css in the customizer, and delete jetpack just to be sure. Yet this css is being loaded from somewhere. I have file explored the crap out of my site trying to find where this is located, but couldn't find anything.
I have found that in the wp-includes/theme.php there is this function:
function wp_custom_css_cb() {
$styles = wp_get_custom_css();
if ( $styles || is_customize_preview() ) : ?>
<style type="text/css" id="wp-custom-css">
<?php echo strip_tags( $styles ); // Note that esc_html() cannot be used because `div > span` is not interpreted properly. ?>
</style>
<?php endif;
}
so this wp_get_customer_css() function is calling the old css from somewhere -- I tried to follow the functions back to see where - but my php is not that good and got lost. Does anyone know where this is being loaded from?
I think I need to know where the JetPack custom css location is. I have read it is generated dynamically -- so I am not sure how to go about the problem.
Edit: I dont get the text box in the custom css area in customizer. Where is this text located?
Edit: I dont get the text box in the custom css area in customizer. Where is this text located?
The Additional CSS content is stored in wp_posts database table as a separate record. It's post_type is set to custom_css. To find which post is assigned to the field, you need to look in the option theme_mods_{your theme's slug}.
For example, here is the one from my test Sandbox site which is running the Genesis Sample theme. The post ID is 31, per the key custom_css_post_id.
How do I check my site?
You can go directly into your database via phpMyAdmin and look in the wp_options table. Or...you can do this:
add_action( 'init', 'check_custom_css_post_id_theme_mod' );
function check_custom_css_post_id_theme_mod() {
var_dump( get_theme_mods() );
}
The above code will display the theme mods for your current theme. Note the one that is keyed as 'custom_css_post_id'. That one holds the ID to the post for the CSS.
How to Remove It
To remove a theme mod, you use remove_theme_mod( 'custom_css_post_id' );. See codex for the documentation on this construct. It will remove the binding between the Additional CSS. How? It deletes the sub-option.
Note, it does not delete the post record, meaning you'll have an orphaned record in wp_posts.
The wp-custom-css is loaded from custom css & js
Everytime i try to add a shortcode into my Wordpress site it ends up merely displaying the code i add to the actual page. I've been pasting the code into the "text" area of the content section but still doesnt work.
Even when I paste inside of the header.php file I recieve the same result. For example.
I recently copy pasted the following code in header.php (as instructed by the plugin i downloaded)
<div class="headerslider"> <?php echo do_shortcode('[sp_responsiveslider limit="-1"]'); ?></div>
When I save a reload, I just get [sp_responsiveslider limit="-1"] appear in my website. This happens with all shortcodes i do.
Please help
It seems like the shortcode sp_responsiveslider isn't actually defined. Are you sure the plugin is installed correctly? If the plugin is installed correctly you can test to see if shortcodes are working on your WordPress installation. Paste the following in your functions.php file (add <?php to the first line if it's not already in the file):
function test_shortcodes()
{
return 'Shortcodes are working!';
}
add_shortcode('test_shortcodes', 'test_shortcodes');
This will create a new shortcode in WordPress. To test if shortcodes are working put the text [test_shortcodes] within a post and view the page with the post. When you load the page the shortcode tag should be replaced with "Shortcodes are working!". If this works, there is an issue with the plugin and it's shortcode.
If the test text is not displayed there might be a problem with your WordPress installation.
i've written a plugin which shortcodes can easily be used in every post and page. As this plugin can be useful in a sidebar as well i want to make the text widget usable for my shortcodes.
When i googled this i found out that i can use the add_filter() function to ensure that, but this is only possible if i have access to the theme's functions.php. But as i am the creator of the plugin and not of the theme, this is not usable for me.
Does anybody know how i can make a shortcode which is introduced with a plugin usable in the widgets section?
Thanks!
Open your theme's function file.
Find a free spot after the opening php tag that isn't part of a function.
add this:
if (!is_admin())
{
add_filter('widget_text', 'do_shortcode', 11);
}
save the file and you should be all set.
Open your page in edit mode.
Select your page location and line where you want to add short code.
Add code here and update..