Friday , December 20 2024

Wordpress

Wordpress – articles, how-to-fix notes, fast solutions

How to remove “Category:” in the title of the article category

This issue is relevant if the title was added using the_archive_title();. To remove the extra phrase “Category:”, you need to use the hook: add_filter( 'get_the_archive_title', 'lets_remove_name_category' ); function lets_remove_name_category( $title ){ if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = …

Read More »

How to display h1 in WordPress theme

This task is relevant for cases when developers in custom templates for some reason decide not to display the page title, although according to all SEO requirements it should be, and should be wrapped in h1. Heading Examples 1. In the page template: in the page.php of your theme, add …

Read More »

Visualcomposer – error array_search() expects parameter 2 to be array, null given (ContentUrlReplaceController.php)

This error appeared after the transfer of the site to another domain. Due to this error, there is no access to /wp-admin, and this error is displayed on the site above the content: Warning: array_search() expects parameter 2 to be array, null given in /wp-content/plugins/visualcomposer/visualcomposer/Modules/FrontView/ContentUrlReplaceController.php on line 68 The error …

Read More »

Contact form in a pop-up window

One of the most popular forms for WordPress is Contact Form 7, but in the settings there is no way to call the form through a click. You can download the Easy Fancybox plugin, go to Settings – Media and in the Enable FancyBox for block, uncheck Images, and check …

Read More »

Contact form 7 with spoilers/accordion

I needed to publish a questionnaire, with answer options opening by clicking on a question. There were no ready-made plugins for implementation, so I made a code for use: Contact Form 7 with accordion Full form template (sorry for the RU answer options): <div class="tabs"> <div class="tab"><input type="radio" id="rd1" name="rd"><label …

Read More »

Include the file and display the value if it is specified in this file

This method was created for SEO edits on the Bitrix site (generated h1 values were entered in the file and displayed in the template). Today I returned to this solution for canonical edits, here is the code and description: <?php include($_SERVER['DOCUMENT_ROOT']."/seo.php");  if(isset($seoh1) AND $seoh1!='') {echo $seoh1;} else {echo $heading_title;} ?> …

Read More »

How to display gc_breadcrumbs in WordPress theme

If the site uses a theme not with default breadcrumbs, but with gc_breadcrumbs, and you use custom post types, then there may be a problem when breadcrumbs are not displayed on the site. Here is the code that allows you to display the plugin anywhere in the site template: <?php …

Read More »

How to add a new menu area in wordpress

In the process of customizing templates, it is often necessary to add and display a new WordPress menu. To do this, you need to paste the following code into functions.php: function wpb_custom_new_menu() { register_nav_menu('my-custom-menu',__( 'My Custom Menu' )); } add_action( 'init', 'wpb_custom_new_menu' ); If you need to add multiple areas …

Read More »

Error Not Acceptable An appropriate representation of the requested resource could not be found on this server.

After transferring the site to another host and trying to save changes in the admin panel, for example, such a code: <p class="block"> <svg xmlns="http://www.w3.org/2000/svg" width="700" height="72" viewBox="0 0 700 72"> <text x="0" y="70">Stroked text</text> </svg> </p> I get an error: Not Acceptable An appropriate representation of the requested resource …

Read More »