IT Blog

  • Blog
  • Technology
    • Technology
    • Architecture
    • CMS
    • CRM
    • Web
    • DotNET
    • Python
    • Database
    • BI
    • Program Language
  • Users
    • Login
    • Register
    • Forgot Password?
  • ENEN
    • 中文中文
    • ENEN
CMS
Wordpress

Rich editor not working

Problem Some user when editing post using rich editor, it appears a simple text box, and missing rich editing feature. Solution In MySQL database wp_usermeta change the meta_value of the user meta_key rich_editing to true. update wp_usermate set meta-value=true where user_id=[userid] and meta_key='rich_editing'; Result  130 total views

2022-12-20 0 Comments 27 Views 0 Like IT Team Read more
Wordpress

How to keep and display contact form 7 data

Display Form Data Almost every website has its own forms, such as contact form, book form, and registry form... Instead of just submitting the form through email, we want to store the form data for the future inconvenience. Here's an example usage of it. Online forms Display form data for certain users Contact Form DB plugin (version >2.4.1) Contact Form 7 is a useful and easy-to-use WordPress plugin. However, after it sends an email the information disappeared. A plugin called "Contact Form DB" can help persist the form data and provide a shortcode to display the data in a data grid format. Once the "Contact Form DB" is activated, it created two data tables: wp_cf7dbplugin_st (storing time key) and wp_cf7dbplugin_submits (storing form data). In WordPress Dashboard, click on the Contact Form DB button on the left side menu. It would show all form data in a table. Under the Contact Form DB button, there is a Shortcode button, it allows you to generate a shortcode of your choice. You could specify a form and the display format and columns to display. The following shortcodes are provided: [cfdb-datatable] [cfdb-table] [cfdb-json] [cfdb-value] [cfdb-count] [cfdb-html] Shortcode details Basic Shortcode You have a form named “myform” and you want to display all its rows and columns in a page or post: [cfdb-table form="myform"] Choose Columns to Display with “show” and “hide” [cfdb-table form="myform" show="f1,f2,f3"] (optionally show selected fields) [cfdb-table form="myform" hide="f1,f2,f3"] (optionally hide selected fields) “show” and “hide” supports regular expressions to be able to specify column names. Regular expression match according to preg-match. Examples: [cfdb-table…

2022-04-15 0 Comments 265 Views 1 Like IT Team Read more
Plugin

Add ALT attribute to Social Media Icon

AlT attribute for an image is helpful factor for SEO. But the plugin "Social Media Share Buttons" by Sygnoos is not adding alt attribute for all social images. The following is my approach to add alt attribute to the social images. For this reason, Bing search console is always give a warning message and refuse to index the site. 1. Find possible keyword using browser tool. 2. locate keyword using Visual Studio find feature. Location: /wp-content/plugins/social-media-builder/js/addNewSection/SGMBWidget.js 3. add alt attribute to the images with jQuery. 4. result: Additionary, to set all images ALT value where alt is missing, using this script: Set alt value to image file name where alt is missing $('img').each(function(i,e){ if($(e).attr('alt')=='') $(e).attr('alt', $(e).attr('src').replace(/^.*(\\|\/|\:)/, '').replace(/\.[^/.]+$/,'')); }); How to get this script? Explained below. //show all img src $('img').each(function(i,e){console.log($(e).attr('src'));}); //show all img alt $('img').each(function(i,e){console.log($(e).attr('alt'));}); //get file name from path filepath.replace(/^.*(\\|\/|\:)/, ''); //get file name without extension from file name filename.replace(/\.[^/.]+$/,''); //show all img file name without extension $('img').each(function(i,e){console.log($(e).attr('src').replace(/^.*(\\|\/|\:)/, '').replace(/\.[^/.]+$/,''));}); //set alt value to image file name where alt is missing $('img').each(function(i,e){if($(e).attr('alt')=='') $(e).attr('alt', $(e).attr('src').replace(/^.*(\\|\/|\:)/, '').replace(/\.[^/.]+$/,''));});    1,002 total views,  3 views today

2021-12-03 0 Comments 338 Views 5 Like IT Team Read more
Wordpress

Change Event Calendar Title

Background Info Theme: OceanWP Plugin: The Event Calendar Solution Event Calendar title in header bar is renderred by theme OceanWP in file: /themes/oceanwp/partials/function oceanwp_title(). The title is get by function oceanwp_title() in file: /themes/oceanwp/inc/helpers.php. In order to override the tile, we created a new file functions-events.php with the following code: if ( ! function_exists( 'oceanwp_title' ) ) {     function oceanwp_title() {         ... //copy code here from theme and insert the following code         if( tribe_is_month() && !is_tax() ) { // Month View Page             $title = esc_html__( 'Metro\'s Event Schedule', 'oceanwp' );         }         elseif( tribe_is_month() && is_tax() ) { // Month View Category Page             //echo 'Metros Event Schedule category page';         }         // Last check if title is empty         $title = $title ? $title : get_the_title();         // Apply filters and return title         return apply_filters( 'ocean_title', $title );     } } In functions.php add include file statement: require_once('functions-events.php' ); Note: Translate Wrap string with function esc_html__() in order to retrieve the translation of the new string. Translate with Loco plugin. First the pot file need to be updated. Make sure the new string is shown in the file. Edit translate file, use Sync button to update the content strings. Result  1,840 total views,  10 views today

2021-11-09 0 Comments 364 Views 3 Like IT Team Read more
Wordpress

Fixing Kratos theme multi-language issue

This is a note for fixing Kratos theme multi-language issue. Basic information Theme: Kratos Language plugins: Polylang, Loco Language settings: en_CA, zh_CN Symptom On English version, always display Chinese words. While OceanWP theme displays correctly for multi-languages. Reason The theme offers multi-language support for American English, Japanese, and Chinese language files: en_US, ja_JP, zh_TW. For English only contains en_US, not en_CA. For multi-language use, I created a en_CA language file under common location: /wp-content/languages/themes/kratos-en_CA.po. In the theme, the language file location is locked on theme directory.  Therefore all other languages that located on other location cannot be found. function theme_languages() { load_theme_textdomain('kratos', get_template_directory() . '/languages'); } add_action('after_setup_theme', 'theme_languages'); Fixing multi-language issue As a quick fix, just change en_CA to en_US, instead of creating another language file. Then it displays as expected. For better solution, the en_CA language file could be copied over to theme language directory, in order to keep Canadian English style.  1,873 total views

2021-03-17 0 Comments 663 Views 4 Like IT Team Read more
Wordpress

How to automatically translate a website to any language

GTranslate is a leading website translation services provider since 2008. It uses Google Translate automatic translation service to translate wordpress site and make it multilingual. It provides 103 languages for your site users to choose from. Web masters can simply choose many combination of language options to allow users to select. Install GTraslate plugin Settings After the activation click on setting link under the plugin name. Or select GTraslate from settings menu. Select languages which are expected to be used by users. Select options. Flags with language name displays languages in flat style with flags and language names. Add to widget It is required to add the translation tool to menu, widget, or somewhere you like. The widget title is optional. Styling the language selection panel <style type="text/css" for="gtranslate"> .widget_gtranslate div.title{ margin:0 10px 0 0 !important; } .widget_gtranslate div.title:after{ background-color:#fff !important; } .widget_gtranslate select{ border:solid 1px #ccc; } a.glink img { width:25px !important; } a.glink { width:103px !important; display:inline-block; } </style> Translate language names in order to display in their own language. <script type="text/javascript" id="gtranslate"> $(document).ready(function(){ $('.widget_gtranslate span').each(function(index, obj){ obj.innerText=obj.innerText.replace('Chinese (Simplified)','简体中文'); obj.innerText=obj.innerText.replace('Chinese (Traditional)','繁体中文'); obj.innerText=obj.innerText.replace('French','Français'); obj.innerText=obj.innerText.replace('German','Deutsche'); obj.innerText=obj.innerText.replace('Japanese','日本語'); obj.innerText=obj.innerText.replace('Korean','한국어'); obj.innerText=obj.innerText.replace('Russian','русский'); }); }); </script> Display result on web page On the website, once a user selects a language the browser remembers the selection, whenever the user navigates to any other page it will translate the contents to the selected language automatically.  2,696 total views,  3 views today

2021-03-06 0 Comments 1005 Views 3 Like IT Team Read more
Wordpress

Controling Category List on Sidebar Widget

Category list on sidebar widget will display all categories on post category hierarchy by default. However, we do not want to display all of them for some reason. Here is simple technique to achieve this goal. Find category IDs First thing to do is to find out all category IDs that we don't want them to show on the sidebar. Run the following script against WordPress MySQL database. SELECT t.term_id catID,t.name FROM wp_terms t join wp_term_taxonomy tax on tax.term_id=t.term_id where tax.taxonomy='category' Snippets //Hide categories from WordPress category widget function exclude_widget_categories($args){ $exclude = "4,6,7,8,9,10,13,14,15,16"; $args["exclude"] = $exclude; return $args; } add_filter("widget_categories_args","exclude_widget_categories"); Apply the snippets There are many ways to apply the snippets. You could add it to theme functions.php file or using snippets plugin to apply the snippets code. In my case, I'm using snippets to apply the code. This way is better organized for reusing the snippets. Last words, This is the simplest way to contorl the category list on sidebar, but you may use other ways to control the category list on sidebar, for instance, find a proper plugin or write your own plugin to achieve it.  9,490 total views,  3 views today

2021-03-04 2 Comments 3331 Views 1 Like IT Team Read more
Wordpress

Restoring the Links Manager

WordPress Links Manager is a tool to manage a set of links. You can add, modify, and remove a link easily from admin dashboard. By default, WordPress come with a widget to add a sidebar, where the links will be shown. The Links Manager is provided by default in earlier versions of WordPress than Version 3.5. However, the WordPress Links Manager and blogroll are hidden for new installs. Moreover, if you used an earlier version than 3.5 and upgraded your installation, then the Links Manager was removed if you don’t have any links. Restoring the Links Manager 1. Using filter Add the following line to your theme’s functions.php file to enable WordPress Links Manager if you are using WordPress version 3.5 or higher To enable Links Manager in version 3.5+, just add the following code to one of the following locations: functions.php file of the theme; php snippets plugin; your own plugin; add_filter( 'pre_option_link_manager_enabled', '__return_true' ); Once enabled, you can see a Links tag in the left panel of the dashboard. 2. Change option value from database If you can access the database you could enable it pritty easy by changing the option value in the database directly. There is an option_name = 'link_manager_enabled' in wp_options table. You can set this value to 1 directly. update wp_options set option_value=1 where option_name='link_manager_enabled'; What Link Manager plugin does is just to change this value in wp_option table behind the scene using filter function. Displaying Links in sidebar WordPress provides a widget within its Links Manager. So you can easily locate links in the sidebar…

2021-02-08 0 Comments 583 Views 1 Like IT Team Read more
Plugin

Adding reCaptcha for user forms in WordPress

Google reCAPTCHA uses an advanced risk analysis engine and adaptive challenges to keep malicious software from engaging in abusive activities on your website. UserWP plugin come with anther plugin that support reCaptcha. Here's the steps to setup. Search for UserWP reCaptcha plugin Install and activate UserWP reCaptcha plugin Go to google reCaptcha admin console Find the link to google admin console under Addons tab, and click on the link. Get key from google provider and fill into plugin settings In google admin console, click on plus sign to add a site, then copy the keys. Enter the site key and secret key into plugin settings Check result on the form  3,780 total views,  5 views today

2021-02-08 0 Comments 801 Views 1 Like IT Team Read more
Wordpress

Scheduling Background Job in WordPress

There are many things have to be done on background, for instance, version check, update theme, delete posts, delayed posting, delete transients, etc. In WordPress this background job is performed by WP-Cron, witch is defined in wp-cron.php file. WordPress cron is the system built-in process that handles the scheduling of time-based tasks. Out-of-the-box, WordPress performs a number of scheduled tasks, they include: WordPress core update checks Plugin update checks Theme update checks Publishing of scheduled posts WP-Cron takes its name from cron, which is a time-based job scheduler in Unix-like systems. However, WP-Cron is designed to work on any hosting provider (including shared hosting) without using any external software or tools for scheduling events. Problem of WP-Cron The wp-cron.php is triggered on every http request. If any scheduled event is due, the event is spawned to wp-cron.php for processing, so the event is triggered to run. This is unreliable, espectially for low traffic sites, or heavily cached sites, cause scheduled events to be missed if no traffic is received for a prolonged period of time. For high-traffic sites, WP-Cron is extremely inefficient. This is because WP-Cron will check for scheduled events on every page load. This could mean that the cron schedules are being checked multiple times per second. This is unnecessary and highly redundant, as scheduled events typically run in minutes or hourly, even monthly interval. Even wp-cron.php creates a lock in WordPress transient, witch stored in wp_options table, but for high traffice sites the high concurrent requests may still spawn multiple requests to wp-cron.php, thus increasing server load.…

2021-02-07 1 Comments 4183 Views 2 Like IT Team Read more
12345…8
Chinese (Simplified) Chinese (Simplified) Chinese (Traditional) Chinese (Traditional) English English French French German German Japanese Japanese Korean Korean Russian Russian
Newest Hotspots Random
Newest Hotspots Random
Rich editor not working Making web page scroll down automatically Getting data from Dapper result All Unicode Chars How to keep and display contact form 7 data Common Regular Expressions
Temporary tables lifetime Theme Demo Setup - BeautyPack Feature image is repeating on post The event Calendar monthly view tooltip location Uploading multiple files - jquery+php Apostrophe menu font too big
Categories
  • Architecture
  • BI
  • C#
  • CSS
  • Database
  • DotNET
  • Hosting
  • HTML
  • JavaScript
  • PHP
  • Program Language
  • Python
  • Security
  • SEO
  • Technology
  • Web
  • Wordpress

COPYRIGHT © 2021 Hostlike IT Blog. All rights reserved.

This site is supported by Hostlike.com