Skip to content

Instantly share code, notes, and snippets.

View RiodeJaneiroo's full-sized avatar
🎯
Focusing

Vadim Zmiievskyi RiodeJaneiroo

🎯
Focusing
  • Ukraine
View GitHub Profile
@RiodeJaneiroo
RiodeJaneiroo / manufacturer.php
Last active April 29, 2019 12:36
[OpenCart 2.x Шаблонные title, descr] #opencart #seo
// catalog/controller/product/manufacturer.php
// start
if ($manufacturer_info['meta_title'] && mb_strtolower($manufacturer_info['meta_title']) != mb_strtolower($manufacturer_info['name'])) {
$this->document->setTitle($manufacturer_info['meta_title']);
} else {
$productTitle = $manufacturer_info['name'] . ' в Украине и Киеве купить в интернет магазине — Choco-Yummy';
$this->document->setTitle($productTitle);
}
if($manufacturer_info['meta_description'] && strlen($manufacturer_info['meta_description']) > 60) {
$this->document->setDescription($manufacturer_info['meta_description']);
@RiodeJaneiroo
RiodeJaneiroo / archive.php
Last active May 3, 2019 08:37
[Wordrepss Breadcrumbs JSON-LD] JSON-LD breadcrumbs #php #seo #wordpress #breadcrumbs
<?php
$cur_cat = get_term_by('id', get_query_var('cat'), 'category');
?>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Created April 26, 2019 05:45
[ wordpress remove feed] #wordpress #seo
<?php
add_action('do_feed', 'itsme_disable_feed', 1);
add_action('do_feed_rdf', 'itsme_disable_feed', 1);
add_action('do_feed_rss', 'itsme_disable_feed', 1);
add_action('do_feed_rss2', 'itsme_disable_feed', 1);
add_action('do_feed_atom', 'itsme_disable_feed', 1);
add_action('do_feed_rss2_comments', 'itsme_disable_feed', 1);
add_action('do_feed_atom_comments', 'itsme_disable_feed', 1);
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active October 1, 2019 10:11
[Wordpress Yoast remove page in canonical] #seo #yoasy #wordpress
add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_home_url_slash' );
function yoast_seo_canonical_change_home_url_slash( $canonical_url ) {
$re = '/\/page\/\d+\//m';
$str = $canonical_url;
$subst = '/';
$result = preg_replace($re, $subst, $str);
return $result;
}
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active January 31, 2023 13:12
[Wordpress Default link image media] in Gutenberg set default in image link media #wp #wordpress #gutenberg
function setDefaultHrefImage() {
wp_enqueue_script(
'modify-image-link-destination-default',
get_template_directory_uri() . '/js/setDefaultHrefImage.js',
array('wp-hooks')
);
}
add_action('enqueue_block_editor_assets', 'setDefaultHrefImage');
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Created April 19, 2019 09:37
[Wordpres Contact Form 7] Add custom tag in CF7 (Pure url) #cf7 #wordpress #contact_form_7
add_filter( 'wpcf7_form_elements', 'do_shortcode' );
function pure_url_cf7_func() {
$submission = WPCF7_Submission::get_instance();
$url = $submission->get_meta( 'url' );
return strtok($url, '?');
}
add_shortcode('puress_url', 'pure_url_cf7_func');
wpcf7_add_form_tag('puress_url', 'pure_url_cf7_func');
@RiodeJaneiroo
RiodeJaneiroo / .htaccess
Last active April 20, 2020 13:53
[Wordpress SEO URL few slash/slesh] redirect from multiple sleshes to one #seo #wordpress #redirect #htaccess #php
RewriteCond %{THE_REQUEST} \ (.*)//+
RewriteRule (.*) https://www.kaper.pro/$1 [R=301,L]
@RiodeJaneiroo
RiodeJaneiroo / function.php
Created April 4, 2019 17:19
[Wordpress ЧПУ URL] делает чпу без слагов #wordpress #redirect #cpt
<?php
add_filter('request', 'rudr_change_term_request', 1, 1 );
function rudr_change_term_request($query){
$tax_name = 'kapers'; // specify you taxonomy name here, it can be also 'category' or 'post_tag'
// Request for child terms differs, we should make an additional check
if( isset($query['attachment']) && $query['attachment']) :
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active March 26, 2019 12:01
[flexible loop ACF] #acf #wordpress #loop
function get_flexible_loop($page_id = null){
if(have_rows('flexible', $page_id)) {
while (have_rows('flexible', $page_id)) {
the_row();
$section_name = str_replace('_', '-', get_row_layout());
get_template_part("/parts/flexible/{$section_name}");
}
}
@RiodeJaneiroo
RiodeJaneiroo / wp_remove_h1_from_editor.php
Last active February 14, 2019 10:08
Remove h1 from the WordPress editor. #wordpress
<?php
/**
* Remove the h1 tag from the WordPress editor.
*
* @param array $settings The array of editor settings
* @return array The modified edit settings
*/
function remove_h1_from_editor( $settings ) {
$settings['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre;';
return $settings;