Skip to content

Instantly share code, notes, and snippets.

View yxod's full-sized avatar
💭
Ehhhh… ¯\_(ツ)_/¯

yxod

💭
Ehhhh… ¯\_(ツ)_/¯
View GitHub Profile
@yxod
yxod / functions.php
Created May 22, 2024 09:55
change admin wordpress
function my_login_stylesheet()
{
wp_enqueue_style('custom-login', get_stylesheet_directory_uri() . '/style-login.css');
}
add_action('login_enqueue_scripts', 'my_login_stylesheet');
function my_login_logo_url()
{
@yxod
yxod / functions.php
Created September 14, 2023 09:16
Wordpress: remove cycled link menu
function wp_nav_menu_no_current_link($atts, $item, $args, $depth)
{
if ($item->current) $atts['href'] = '';
return $atts;
}
add_filter('nav_menu_link_attributes', 'wp_nav_menu_no_current_link', 10, 4);
@yxod
yxod / functions.php
Created June 7, 2023 12:53
add canonical paged category
// add canonical category paged
function yoast_seo_canonical_change_woocom_shop($canonical)
{
if (is_paged() && is_category()) {
$category = get_queried_object();
$category_link = get_category_link($category);
$canonical = esc_url($category_link);
}
return $canonical;
@yxod
yxod / functions.php
Created May 11, 2023 14:31
remove wp adds
//** Speed Up Wordpress **/
remove_action('wp_head','wp_generator');
remove_action('wp_head','wlwmanifest_link');
remove_action('wp_head','wp_resource_hints', 2);
remove_action('wp_head','wlwmanifest_link');
remove_action('wp_head','rsd_link');
remove_action('wp_head','rel_canonical');
remove_action('wp_head','wp_site_icon');
remove_action('wp_head','wp_oembed_add_discovery_links' );
remove_action('wp_head','wp_oembed_add_host_js' );
<?php if (current_user_can('editor') || current_user_can('administrator')) { ?>
<?php } ?>
@yxod
yxod / functions.php
Last active July 9, 2024 14:11
add edit url
//get edit link
function get_edit()
{
if (current_user_can('editor') || current_user_can('administrator')) {
echo '<a target="_blank" href="' . get_edit_post_link(get_the_ID()) . '" class="edit-post-link dashicons dashicons-edit" title="Edit project"></a>';
}
}
@yxod
yxod / functions.php
Created January 18, 2022 10:46
clear wp
//remove emoji support
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
// Remove rss feed links
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
// remove wp-embed
add_action( 'wp_footer', function(){
@yxod
yxod / common.js
Created November 1, 2021 09:23
Wordpress Cf7 add events
<script>
(function(dl) {
function pushData(eventName, userName, userPhone) {
dl.push({
'event': eventName,
'name': userName,
'phone': userPhone
})
}
@yxod
yxod / functions.php
Created October 21, 2021 19:15
Wordpress: Acf option page
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Настройки темы',
'menu_title' => 'Настройки темы',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
));
@yxod
yxod / functions.php
Created October 8, 2021 15:10
Wordpress: Yoast separator
function filter_wpseo_breadcrumb_separator($this_options_breadcrumbs_sep)
{
return '<img class="separ" src="/wp-content/uploads/2021/10/icon.svg">';
};
// add the filter
add_filter('wpseo_breadcrumb_separator', 'filter_wpseo_breadcrumb_separator', 10, 1);