Skip to content

Instantly share code, notes, and snippets.

<? phpinfo();
add_filter('aioseop_title', 'sowich_title', 10, 2);
function sowich_title($title, $id = null){return implode(' | ', array_diff(array_map('trim', explode('|', $title)), ['', null, ' ']));}
@sowich
sowich / gist:8403ad5acaa6f9c79e00a17ea908d53f
Last active May 27, 2016 10:19
Проверка на preview картинку
<?php
$img = false;
if (preg_match('#a[^>]+class=\"more-link\"#i', get_the_content()))
$img = true;
?>
<?php if ($img): ?>
<img src="<?php echo catch_that_image() ?>" class="news-img" alt="<?php the_title(); ?>"/>
<?php endif; ?>
...
@sowich
sowich / gist:17e99a4acf497179ed996a5a3c8ded40
Created June 3, 2016 09:06
Открытие с index.php
//function.php
remove_filter('template_redirect', 'redirect_canonical');
find /PATH -type f -exec chmod 644 {} +
@sowich
sowich / unused_tags.php
Last active July 4, 2016 06:14
wordpress отключение служебной инфы
<?php
//........
// отключаем emoji
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('admin_print_styles', 'print_emoji_styles');
@sowich
sowich / nofollow.php
Last active September 1, 2018 07:56
<?php
add_filter('wp_list_categories', 'esc_wp_rel_nofollow');
add_filter('wp_tag_cloud', 'esc_wp_rel_nofollow');
function esc_wp_rel_nofollow($output)
{
if (is_single() || is_category() || is_tag())
return stripslashes(wp_rel_nofollow($output));
return $output;
<?php #ВСТАВИТЬ В ФАЙЛ "archive.php" ?>
<?php if (is_tag()): ?>
<?php foreach (getCatsToTags() as $category) : ?>
<?php $anchor = get_the_category_by_ID($category) ?>
<a href="<?php echo esc_url(get_category_link($category)) ?>" title="<?php echo esc_html($anchor) ?>"><?php echo esc_html($anchor) ?></a>
<?php endforeach; ?>
<?php endif; ?>
<?php #ВСТАВИТЬ В ФАЙЛ "functions.php" ?>
@sowich
sowich / wp-query-ref.php
Created July 25, 2016 06:25 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
git archive --format=zip --remote=<$PATH> HEAD > <$NAME_PLUGIN>.zip