How about working with a team that puts the worries of the virtual environment aside and makes this burden more attractive to you with its wide range of services?
Contact Now: +90 850 305 25 95
E-mail:info@margarit.com.tr
Address: İvoksan, Neva Home Offices
1455 Street, 22/41 Yenimahalle / Ankara

Standard WordPress questions and quick answers

margarit-web-reklam-bilisim-2020

The ordeal of WordPress users is never-ending. As an open source CMS system, WordPress has unlimited functionality and intellectual application, so conflicts of problems are inevitable with the combination of many ideas.

In general, we try to offer solutions by responding with codes to a few issues that our friends who are looking for minimal solutions with a WordPress theme often encounter and think about how to do. Glad we can be useful.

How to create new sidebar (side menu) in WordPress theme?

First of all, we want to provide a quick solution to the Sidebar problem, which users often think about how to do.

While the functional inadequacy of the light-weight themes, which do not have code weight, unfortunately ties us up in the use of WordPress, the modifications made in Functions.php can cause problems in the long run. Do not forget to guarantee yourself with a backup file before the modification process.

functions.php into the file:

<?php add_action( &#39;widgets_init&#39;, &#39;my_register_sidebars&#39; );

function my_register_sidebars()

{ /* Register the &#39;primary&#39; sidebar. */ register_sidebar( array( &#39;id&#39; => &#39;primary&#39;, &#39;name&#39; => __( &#39;Primary&#39; ), &#39;description&#39; => __( &#39;A short description of the sidebar.&#39; ), &#39;before_widget&#39; => &#39;<div id="%1$s">&#39;, &#39;after_widget&#39; => &#39;</div>&#39;, &#39;before_title&#39; => &#39;<h3>&#39;, &#39;after_title&#39; => &#39;</h3>&#39; ) ); /*

Repeat register_sidebar() code for additional sidebars. */ } ?>

After placing the codes, it will be enough to add the following single line code in the sidebar.php file.

<div id="sidebar-primary" class="sidebar"> <?php dynamic_sidebar( &#39;primary&#39; ); ?> </div>

How to make mobile redirect with WordPress htaccess?

I ended up with a solution on the stackoverflow site to the question of how I can make mobile redirects with htaccess in my WordPress system, I would like to share it with you and myself to keep it as an archive. Please replace website.com with your own site.

RewriteRule ^ – In the section specified as [CO=mredir:0:www.website.com], you can edit the subdomain as m.website.com.

RewriteEngine on RewriteBase / RewriteCond %{QUERY_STRING} (^|&)m=0(&|$) RewriteRule ^ - [CO=mredir:0:www.website.com] RewriteCond %{HTTP:x-wap-profile} ! ^$ [OR] RewriteCond %{HTTP:Profile} !^$ [OR] RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell| cldc|cmd-" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g| lge-" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR] RewriteCond %{ HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send| serial|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1| upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR] RewriteCond 1T P2T{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC ] RewriteCond %{HTTP_USER_AGENT} !macintosh [NC] RewriteCond %{HTTP_HOST} !^m. RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC] RewriteRule ^ http://m.website.com [R ,L]

Let's add a bonus problem, I'm posting a solution that is hard to find when looking for a pinpoint solution, but simple to implement once you have the relevant codes.

I would like to add a permanent solution, as I constantly see these errors, which cause excessive slowness and server load on my WordPress-based sites, in the error logs.

mod_fcgid: read data timeout in, Premature end of script headers, wp-cron.php, mod_fcgid: can't apply process slot for

In this way, I will find it easily, and you will get a definite solution to your problem.

For those who get the annoying WordPress error, mod_fcgid: read data timeout in, Premature end of script headers, wp-cron.php, mod_fcgid: can't apply process slot for errors via wp-cron.php, 30 seconds or 60 seconds If you are tired of making your site inaccessible during the timeout set in seconds, just apply what I wrote.

1. The wp-cron.php file calls a file named cron.php and is usually located under root/wp-includes/.

Find the cron.php file and the values in it;

This value:

spawn_cron( $local_time );

Change it like this by adding two slash at the beginning:

// spawn_cron( $local_time );

2. Secondly, in the Cron.php file;

if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false || ( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ) ) if ( strTPSUTPOST1TVER3T1; , '/wp-cron.php') === false || ( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ) )

change to . Basically, you're deleting an exclamation point and adding an equal sign, but a lot is changing.

3. Finally, add the following line to the wp-config.php file in the main directory.

define('DISABLE_WP_CRON', true);

Then repeat your site, see if there is a difference..

Thank you.

No Comments
Post a comment

en_USEnglish