IT Blog

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

Hide author information from WordPress

Author information is an important part of a blog, but for some reason you have to hide it. For example, the blog is a result of multiple authors. 1. Simply hide author information using stylesheet. Add custom css (look like the following): .author,.postauthor-container { display:none; visibility:hidden; } .uwp_widget_author_box { display:none; visibility:hidden; } /* UserWP plugin */ 2. Using "Hide/Remove Metadata" plugin 3. Change code The author information is written by theme, so you have to find out the php code location in order to make change. The possible location is on the following files: single.php, content.php, archive.php, index.php, functions.php, template-tags.php For example, in the theme "Twenty Nineteen" the code is on "twentynineteen_posted_by" function in template-tags.php file. Note that, before making any change on the theme code please make a full backup.   Hope this informaiton will help some people :)

2021年01月03日 0条评论 88点热度 1人点赞 阅读全文
Wordpress

How to do some trick to improve WordPress performance

There are many ways to improve WordPress performance. But here I would introduce a trick to dramatically improve the page loading speed. Convert to html page As a web page the ultimate content is html code. If we could response in html directly without bothering the server code and database to run the page would be loaded really quick. make sure the web page working as expected use browser developer tool to view the source copy the html source code go to File Manager of the CPanel, manually create folders and index.html file according to the url pathFor example: for url "https://hostlike.com/zh/web-hosting/"create folder /zh/web-hosting/, then create file index.html under the new folder open index.html with file editor paste the copied content to the index.html file save the content. Dynamic content trick If there is dynamic content, e.g. shopping cart item number. We can use JavaScript to update the value. Add the following JavaScript code to the end of index.html content. function getCookie(name) { const value = `; ${document.cookie}`; const parts = value.split(`; ${name}=`); if (parts.length === 2) return parts.pop().split(';').shift(); } var cart_count = getCookie('woocommerce_items_in_cart'); $('.wcmenucart-details').text(cart_count);

2020年12月29日 1条评论 75点热度 1人点赞 阅读全文
Wordpress

Recovering user role in WordPress

The administrator role somehow loss admin privillage, to restore it as an admin, we could update 2 rows information in database easily. The following DML will restore the admin privillage. set @id=1; update wp_usermeta set meta_value='10' where user_id=@id and meta_key='wp_user_level' update wp_usermeta set meta_value='a:1:{s:13:"administrator";b:1;}' where user_id=@id and meta_key='wp_capabilities' The admin role is controlled by user level and capability attributes, and these information are stored in wp_usermeta table. User level: User Level 0 converts to Subscriber User Level 1 converts to Contributor User Level 2 converts to Author User Level 3 converts to Editor User Level 4 converts to Editor User Level 5 converts to Editor User Level 6 converts to Editor User Level 7 converts to Editor User Level 8 converts to Administrator User Level 9 converts to Administrator User Level 10 converts to Administrator Capability: Refer to: Roles and Capabilities for detail information. In wp_usermeta table the meta_value stored as role: Admin:            a:1:{s:13:"administrator";b:1;} Author:           a:1:{s:6:"author";b:1;} Contributor:  a:1:{s:11:"contributor";b:1;} Subscriber:    a:1:{s:10:"subscriber";b:1;}

2020年12月24日 0条评论 104点热度 1人点赞 阅读全文
Wordpress

Restrict WordPress user access some contents

Scenario Certain contents are allowed by specific group of users to access. Membership roles concept With Members plugin, user roles can be managed in dashboard. Role permissions are called capability. The capabilities are defined based on themes and plugins. The following figure shows the basic role capabilities. Solution Add a user role that allows users to access those restricted contents. Steps 1. Members plugin Install plugin called "Members – Membership & User Role Editor Plugin". 2. Setup roles Go to Members on the left menu of Dashboard. Here you could add a new role or edit an existing role, and then assign permissions, which called capability within the plugin, to the role. 3. Add user to a role Go to Users menu, click on the user that you want to edit. Scrolldown to the bottom, the last section is User Roles. Select the role to assign. 4. Restrict page access by role On the page/post editor, scrolldown to the last section "Content Permission", assign page with the role that is allowed to access the page/post. Done. Now you have restrict the page to be accessed only the users with the role.

2020年12月03日 0条评论 37点热度 0人点赞 阅读全文
Security

Mixed Content warning: request an insecure element was automatically upgraded to HTTPS

After applied SSL settings to enforce HTTPS browser starts complaining "Mixed Content: ..." as the image shown bellow. "Mixed Content" warnings occur when an HTTPS page is asked to load a resource over HTTP. Insecure resources are vulnerable to alteration by an active attacker or eavesdropping by a passive attacker, which violates the user's expectation of security for an HTTPS page. Ref: Fixing mixed content for more information. Fix: Change all insured links with "http://" to "https://" on the page. This could a tough work and time consuming. The following is a hot fix, it works very well for me. Hot fix: Add meta content in html head section to allow browser automatically upgrade http to https, ensure loading contents through SSL layer. <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

2020年12月02日 0条评论 31点热度 0人点赞 阅读全文
Security

Removing WP-VCD malware

Yesterday, I was notified there were malicious activity from your website, a huge number of email spam messages is originating from it.211cn.ca. As a result the website was suspended as limited access, which only allow registered IP can access the website. When I logon, notification appeared on the panel. And my.siteground home Detail notification In the review panel I saw a list of files that contains malicious code. GEN|eval_base64decode|92ac7c84794de23675efab25846195ea|07/09/20| /home/hostlike/pubweb211/211it/blyuzewtpd.php GEN|eval_base64decode|92ac7c84794de23675efab25846195ea|07/09/20| /home/hostlike/pubweb211/211it/ndxwcecntb.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|11/09/20| /home/hostlike/pubweb211/211it/vckkmhpjam.php GEN|eval_base64decode|92ac7c84794de23675efab25846195ea|07/09/20| /home/hostlike/pubweb211/211it/lllriasktz.php GEN|eval_base64decode|b200c70d10b280b747353869008d8975|10/09/20| /home/hostlike/pubweb211/211it/guzzmmgqcc.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/cmswprkgwt.php GEN|eval_base64decode|6d9dc920c3142026786fac9ef4a85b7f|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/upmnzusqae.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/awiotljzvb.php HEX|strrev_gzinflate_obfusc|69f9670e8743e996e97b271aa8570044|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/rsixodaduj.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/wcbwqrugyx.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/zrjkkylnkr.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/oqjfkoyenl.php HEX|strrev_gzinflate_obfusc|69f9670e8743e996e97b271aa8570044|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/qbhdyxlhku.php HEX|strrev_gzinflate_obfusc|69f9670e8743e996e97b271aa8570044|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/wgmtivragq.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/hiqobbrcem.php HEX|strrev_gzinflate_obfusc|69f9670e8743e996e97b271aa8570044|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/smkjoogdfw.php HEX|strrev_gzinflate_obfusc|69f9670e8743e996e97b271aa8570044|07/09/20| /home/hostlike/pubweb211/211it/wp-content/plugins/wp-file-manager/lib/files/mmnudpdxaj.php STR|wp_vcd_malware|8125436f73ec321255941993e83d4215|17/05/19| /home/hostlike/pubweb211/211it/wp-content/themes/apostrophe-2-wpcom/functions.php STR|wp_vcd_malware|3bd15df2ee78583e0e5249c20b004570|17/05/19| /home/hostlike/pubweb211/211it/wp-content/themes/twentynineteen/functions.php STR|wp_vcd_malware|89e770805bc10deaaed0bc2b5e5e2044|17/05/19| /home/hostlike/pubweb211/211it/wp-content/themes/apostrophe-2-wpcom-child/functions.php STR|wp_vcd_malware|3342254765f2895b7287d55206c4715a|30/12/19| /home/hostlike/pubweb211/211it/wp-content/themes/twentytwenty/functions.php STR|wp_vcd_malware|6a87f54f37ac47b27764d760559444fe|17/05/19| /home/hostlike/pubweb211/211it/wp-content/themes/twentyseventeen/functions.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|10/09/20| /home/hostlike/pubweb211/211it/hllyqgfyoo.php GEN|eval_base64decode|d2015c782da6ab8e637d8e6fe7318d06|11/09/20| /home/hostlike/pubweb211/211it/F0xAutoConfig/inthagame.php GEN|eval_base64decode|d2015c782da6ab8e637d8e6fe7318d06|22/02/18| /home/hostlike/pubweb211/211it/api/intrigantes.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|10/09/20| /home/hostlike/pubweb211/211it/jsilrrlpdj.php STR|wp_vcd_malware|6fc123ea0b9564867df8f3391206f05c|02/01/20| /home/hostlike/pubweb211/211it/wp-includes/post.php STR|wp_vcd_malware|6e618a387332c93c2f78e08f21c724d3|17/01/20| /home/hostlike/pubweb211/211it/wp-includes/wp-vcd.php HEX|js_url_slider|92ea63f479cf2a449af94368f951010f|06/09/20| /home/hostlike/pubweb211/211it/wp-includes/wp-tmp.php GEN|eval_base64decode|d2015c782da6ab8e637d8e6fe7318d06|17/05/19| /home/hostlike/pubweb211/211it/wp-snapshots/intro.php HEX|eval_gzinflate_b64d_0|8266b96d0ba86770c9f7edf62198a003|07/05/19| /home/hostlike/pubweb211/211it/pages/tk_desk.php HEX|eval_gzinflate_b64d_0|8266b96d0ba86770c9f7edf62198a003|22/02/18| /home/hostlike/pubweb211/211it/tools/tjsend.php GEN|eval_base64decode|d6a7b5db62bf7815a10a17cdf7ddbd4b|10/09/20| /home/hostlike/pubweb211/211it/dvflreeurs.php HEX|remote_content_includer_6|3480dcf23fdfa81ed608897c2680bb4a|07/09/20| /home/hostlike/pubweb211/211it/vynugoevjh.php WP-VCD malware is used to add an admin user, it hides in legitimate WordPress files. The initial version of this threat was uploaded via wp include file called wp-vcd.php. The malicious code is injected into Wordpress core files like functions.php, class.wp.php, post.php, and also injected into WordPress themes, including child theme. It was reported that WP-VCD malware is a malicious code that comes bundled with illegitimate versions of a paid theme/plugin. These pirated themes and plugins incorporate malicious scripts that get inserted once you install them. Once leaked to your website though a nulled theme, it starts spreading to infect other themes on your site and even proliferates to infect every unprotected site hosted on the shared server. If you’ll look for “Free [pugin…

2020年09月27日 0条评论 28点热度 1人点赞 阅读全文
Plugin

WordPress EventCalendar visibility

Based on the official knowledge base, currently there is no “out of the box” way to control events visibility — no plugin setting,  plugin filter,  etc.  But with a bit of custom coding, you can get pretty close. 1. Hide event from month view if the use is not logged in. Ref: https://theeventscalendar.com/knowledgebase/k/making-a-members-only-calendar/ 1. create a event category: Agent Assign the event to the category. 2. add stylesheet, e.g. Custom CSS & JS plugin. .type-tribe_events.tribe-events-category-agent { display: none; } body.logged-in .type-tribe_events.tribe-events-category-agent { display: inline; } 2. disable popup tip window. ref: https://theeventscalendar.com/support/forums/topic/disabling-the-calendar-pop-up-views/ body .tribe-events-calendar .tribe-events-tooltip { visibility:hidden; } @media (max-width: 600px) { body .tribe-events-calendar .tribe-events-tooltip { visibility:hidden; } }  

2020年08月20日 0条评论 14点热度 0人点赞 阅读全文
Plugin

Entering large number of Envira Galleries at a time

Problem Over a few years there are large number of photos in facebook. The MPP want to copy all the photos in facebook to his own gallery on his website. The gallery on the site is using plugin - Envira Gallery. Normally, we create a gallery by drag-drop photos one by one, then place the shortcode on to a post or page. Now we have created all the gallery, the next step is to create posts to acommodate these galleries. The problems left are create posts for each gallery how to please handreds of gallery posts to the menu add featured image to each post Basic informaiton Envira Gallery stores gallery in wp_posts table with post_type = 'envira'. Regular posts are stored in the same table with post_type='post'. The data for the photos in a gallery is stored in wp_postmeta table with meta_key = '_eg_gallery_data' Category information is stored in wp_term_replationships table with object_id = post_id, term_taxonomy_id identifies its category, for gallery term_taxonomy_id=32. Solution Create post list using plugin Advanced Post List. Add posts for each gallery in batch List gallery title, gallery ID in excel in order to generate sql statement to create posts. The formula for cell D3 as following. =$D$1&"(1,'"&YEAR(C3)&"-"&MONTH(C3)&"-"&DAY(C3)&"', '"&YEAR(C3)&"-"&MONTH(C3)&"-"&DAY(C3)&"','[envira-gallery id=\"""&A3&"\""]','"&B3&"','','publish','closed', 'closed','','"&SUBSTITUTE(LOWER(B3)," ","-")&"','','','"&YEAR(C3)&"-"&MONTH(C3)&"-"&DAY(C3)&"','"&YEAR(C3)&"-"&MONTH(C3)&"-"&DAY(C3)&"','',0,'http://domain.com/?page_id=', 0,'post');" The formula on cell C3 as following. ="2018-"&IFERROR(MONTH(LEFT(RIGHT(B3,6),3)&" 1"),MONTH(LEFT(RIGHT(B3,5),3)&" 1"))&"-"&RIGHT(RIGHT(B3,6),2) Change create date for galleries. This is not necessory, but to do this we can use this script in excel cell F3. ="update wp_posts set post_date='"&YEAR(C3)&"-"&MONTH(C3)&"-"&DAY(C3)&"' where id="&A3&";" Set Featured Image to posts Using the first photo in gallery as the featured image.…

2020年03月30日 0条评论 23点热度 0人点赞 阅读全文
Plugin

Adding Featured Image for Envira Gallery posts in batch

Featured Image Featured images are stored in meta_value with meta_key='_thumbnail_id' in wp_postmeta table. SELECT * FROM wp_postmeta WHERE meta_key='_thumbnail_id' and post_id=@post_id Add featured image direct into database Find out the id of the image that you want to be a featured image in wp_post table, then insert a record into wp_postmeta table with meta_key='_thumbnail_id' @image_id = select id from wp_post where post_type='attachment' and post_mime_type='image/jpeg' insert into wp_postmeta (post_id,meta_key,meta_value) values (147, '_thumbnail_id',@image_id); Gallery Photos Photos in Envira Gallery are stored in meta_value with meta_key='_eg_gallery_data' in wp_postmeta table. select * from wp_postmeta where meta_key='_eg_gallery_data' Data stored looks like this: a:3:{s:2:"id";i:3972;s:7:"gallery"; a:8:{i:3973;a:7:{ s:6:"status";s:6:"active"; s:3:"src"; s:102:"http://vincentkempp.com/wp-content/uploads/2020/03/85092119_2768984699811558_8547879668101939200_n.jpg"; s:5:"title";s:47:"85092119_2768984699811558_8547879668101939200_n"; s:4:"link";s:102:"http://vincentkempp.com/wp-content/uploads/2020/03/85092119_2768984699811558_8547879668101939200_n.jpg"; s:3:"alt";s:0:"";s:7:"caption";s:0:"";s:5:"thumb";s:0:"";} Get the first image inside the gallery: SELECT p.id gallery_id, substring(meta_value, locate(':"http://', m.meta_value)+2, locate('";s:5:"title";', m.meta_value)-locate(':"http://',m.meta_value)-2) featured_image FROM wp_posts p JOIN wp_postmeta m on m.post_id=p.id and p.post_type='envira' and p.post_status='publish' and m.meta_key='_eg_gallery_data' ORDER BY p.id Check if the gallery post already has featured image. SELECT m.post_id,post_title, m.meta_value image_id FROM wp_posts p JOIN wp_postmeta m on m.post_id=p.ID and p.post_type='post' and p.post_content LIKE '[envira-gallery id=%' and p.post_status='publish' WHERE meta_key='_thumbnail_id' Get relationship between post_id and gallery_id SELECT p.id,post_title, substring(p.post_content, 21, locate('"]',p.post_content)-21) gallery_id, p.post_content FROM wp_posts p LEFT JOIN wp_postmeta m on m.post_id=p.ID and meta_key='_thumbnail_id' WHERE p.post_type='post' and p.post_content LIKE '[envira-gallery id=%' and p.post_status='publish' and meta_key is null ORDER by p.id Adding featured images INSERT INTO wp_postmeta (post_id,meta_key,meta_value) SELECT p1.id,'_thumbnail_id',img.id FROM ( SELECT p.id,post_title, substring(p.post_content, 21, locate('"]',p.post_content)-21) gallery_id FROM wp_posts p LEFT JOIN wp_postmeta m on m.post_id=p.ID and meta_key='_thumbnail_id' WHERE p.post_type='post' and p.post_content LIKE '[envira-gallery id=%' and p.post_status='publish' and meta_key is null ) p1 -- post_id JOIN ( SELECT p.id gallery_id,…

2020年03月29日 0条评论 235点热度 0人点赞 阅读全文
Wordpress

WordPress Featured Image in database

How featured image stored in MySQL database? Featured image in wp_posts table: post_author = '77777' post_parent = [post_id] guid = [image url] post_type = 'attachement' post_mime_type = 'image/jpeg' Featured image in wp_postmeta table: There are 3 meta_keys hold the image information. post_id, meta_key, meta_value = [post id], '_thumbnail_id', [featured image post id] post_id, meta_key, meta_value = [featured image post id], '_wp_attached_file', [image url] post_id, meta_key, meta_value = [featured image post id], '_wp_attachment_image_alt', [image alt] Optimize data structure Move the featured image record right next to the post. set @id = 2334; -- post id set @id1 = 2335; -- new image post id set @id2= 2339; -- old image post id update wp_posts set id=@id1 where id=@id2; update wp_postmeta set post_id=@id1 where post_id=@id2 and meta_key like '_wp_attach%'; update wp_postmeta set meta_value=@id1 where post_id=@id and meta_key='_thumbnail_id';

2020年02月20日 0条评论 587点热度 0人点赞 阅读全文
12345…7
最新 热点 随机
最新 热点 随机
Generating Test Data with SQL Scripts Remote connection to MySQL on SiteGround Hide author information from WordPress How to do some trick to improve WordPress performance Recovering user role in WordPress Sending email using gmail SMTP
How to do some trick to improve WordPress performanceRemote connection to MySQL on SiteGroundGenerating Test Data with SQL ScriptsRecovering user role in WordPressHide author information from WordPress
工业企业订单管理系统升级(2) — 数据读取器读取数据 Start build from Team Explorer Crawler - Split column The events calendar - event title location Using widget components in any place Entering large number of Envira Galleries at a time
Categories
  • AdSense
  • Architecture
  • BI
  • C#
  • CSS
  • Database
  • Digital Marketing
  • DotNET
  • Hosting
  • HTML
  • JavaScript
  • PHP
  • Program Language
  • Python
  • Security
  • SEO
  • Technology
  • Web
  • Wordpress

COPYRIGHT © 20203-2021 Hostlike.com. ALL RIGHTS RESERVED.