Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Alexander Teshabaev bologer

🎯
Focusing
Block or report user

Report or block bologer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bologer
bologer / ac_get_post_rating.php
Last active Jun 12, 2019
AnyComment получить рейтинг записи
View ac_get_post_rating.php
<?php
// Функцию ниже нужно добавить в functions.php вашей темы
// Пример вывода в single.php: echo ac_get_post_rating(get_the_ID());
/**
* Возвращает рейтинг записи по ID записи.
*
* @see \AnyComment\Models\AnyCommentRating::get_average_by_post() для подробной информации.
* @return float
*/
@bologer
bologer / functions.php
Created Feb 12, 2019
Remove WooCommerce tab from AnyComment
View functions.php
<?php
add_filter( 'woocommerce_product_tabs', 'sb_woo_remove_reviews_tab', 1000);
function sb_woo_remove_reviews_tab($tabs) {
unset($tabs['reviews']);
return $tabs;
}
@bologer
bologer / exclude_anycomment.php
Last active Jan 12, 2019
Exclude anycomment core js asset in j news
View exclude_anycomment.php
<?php
// Только без "<?php" выше
add_filter( 'minit-exclude-js', function($excludes) {
$excludes[] = 'anycomment-js-bundle';
return $excludes;
});
@bologer
bologer / gist:70e5513f35c9020a9961a768c1c56c14
Created Jan 7, 2019 — forked from saippuakauppias/gist:4714695
javascript vkontakte api wall post: постинг на стену к текущему пользователю на JS vk API. С помощью этого кода так же можно отправлять записи на стены групп, пользователей и публичных страниц (пабликов). Используется в iframe приложениях вконтакте.
View gist:70e5513f35c9020a9961a768c1c56c14
/*
* message - сообщение, которое будет опубликовано
* image - картинка для постинга
* user_id - id текущего пользователя (к нему будет осуществлён постинг)
*/
function wallPost(message, image, user_id) {
VK.api('photos.getWallUploadServer', {
uid: user_id
}, function (data) {
if (data.response) {
@bologer
bologer / functions.php
Created Nov 3, 2018
Hide admin bar from users who cannot manage options
View functions.php
<?php
/**
* Disable admin bar for users who cannot manage options.
*/
function anycomment_disable_admin_bar() {
if ( is_plugin_active( 'anycomment/anycomment.php' ) ) {
if ( ! current_user_can( 'manage_options' ) ) {
show_admin_bar( false );
}
@bologer
bologer / functions.php
Last active Nov 3, 2018
Add custom classes to #comments for AnyComment
View functions.php
<?php
function anycomment_custom_js() {
?>
jQuery(document).on('ready', function($) {
$('#comments').addClass('gridlove-comments gridlove-box box-inner-p-bigger');
});
<?php
}
add_action('wp_footer', 'anycomment_custom_js');
@bologer
bologer / converTablesToCollation.php
Created Sep 6, 2018
Convert tables to the required collation in Yii2
View converTablesToCollation.php
$wantedCollation = 'utf8_unicode_ci';
$command = Yii::$app->getDb()->createCommand('SHOW TABLE STATUS');
$tableCollations = $command->queryAll();
if (!empty($tableCollations)) {
foreach ($tableCollations as $tableCollation) {
$tableName = $tableCollation['Name'] ?? null;
@bologer
bologer / hidden-products.md
Last active Oct 19, 2017
Show hidden products
View hidden-products.md
  1. Open wp-content/themes/royal/woocommerce/content-product-gift.php and delete/comment the following lines:
//if ( ! $product || ! $product->is_visible() )
//	return;
  1. Open wp-content/themes/royal/page-profile-template.php

Change:

@bologer
bologer / content-single-product.md
Last active Oct 8, 2017
1 пункт, скрыть sidebar, цены
View content-single-product.md
  1. Открыть wp-content/themes/royal/functions.php
  2. Добавить функцию
/**
 * Check whether user is a cardholder or not.
 * @return bool
 */
function is_cardholder()
{
    if (!is_user_logged_in()) {
You can’t perform that action at this time.