At first, as a person from the 17th century, I tried stupidly to remove these types in the template code, but this process did not give a result and the validator continued to show warnings. The solution is simpler than it seems at first: In the folder with the template, …
Read More »How to randomly display multiple words using PHP
Without long preliminary explanations, I am posting the working code here. <?php $input = array("test1", "test2", "test3", "test4", "test5", "test6", "test7", "test8", "test9", "test10"); $rand_keys = array_rand($input, 5); echo $input[$rand_keys[0]] . ", "; echo $input[$rand_keys[1]] . ", "; echo $input[$rand_keys[2]] . ", "; echo $input[$rand_keys[3]] . ", "; echo $input[$rand_keys[4]] …
Read More »ACF not showing up in WooCommerce categories
By default, ACF fields can be displayed like this: <?php the_field('slogan');?> or like this: <?php if( get_field("slogan") ): ?> <?php the_field( "slogan" ); ?> <?php else :?> Custom text if needed. <?php endif; ?> In WooCommerce, this construction does not work, below are correct code example: $queriedObject = get_queried_object(); echo …
Read More »301 redirect from index.php except admin folder
Description of the problem – if you add a standard redirect from index.php to the root of the site, this rule will by default apply to the site admins. For Joomla and Вitrix, the result will be the inability to log in to the admin panel, because the index will …
Read More »500 internal server error when “URL Redirect” is enabled in Joomla
I had a case – to remove /index.php from the URL in the menu items for the main and internal pages on the site. To do this, first go to System – General Settings – SEO Options and enable SEF and URL Redirection. After that, it is possible that internal …
Read More »How to remove the link from the logo for the main page in CS Cart
By default, all pages in the site header have a link from the logo to the home page. According to some SEO audits, it is recommended to remove the particular link to the home page from the logo. In CS Cart, the logo file is placed in /design/themes/template/templates/blocks/static_templates/logo.tpl To solve …
Read More »How to display Breadcrumb NavXT anywhere in a WordPress theme
First, install the Breadcrumb NavXT plugin. To display breadcrumbs anywhere in your template, use the code to copy-paste into your theme files: <div class="breadcrumbs" typeof="BreadcrumbList" vocab="http://schema.org/"> <?php if(function_exists('bcn_display')) { bcn_display(); }?> </div>
Read More »Sorry, you are not allowed to continue in the WordPress
If you see an error like this when logging in to /wp-admin/ or /wp-login.php If you are sure that you didn’t do anything wrong and “it broke itself”, then use FTP to enter the /wp-content/plugins/ folder, look for the wp-cerber folder there and rename it, then try again to enter …
Read More »How to add custom CSS for WordPress admin panel
If you need to place a few CSS lines for the admin panel, then edit the file functions.php at the root of the theme, and add it to the end of the file: add_action('admin_head', 'admin_styles'); function admin_styles() { echo '<style> .update-nag {display: none !important;} </style>'; } Instead of the .update-nag …
Read More »301 redirect in PHP
There are different reasons for different engines to add 301 redirects not in .htaccess. For DLE, PHP redirects are the only way to avoid looking at dynamic garbage generated in links. Examples implementation in PHP: if ( getenv('REQUEST_URI') == '/page-before-redirect/' ) { header( "HTTP/1.1 301 Moved Permanently" ); header( "Location: …
Read More »