Skip to content

Instantly share code, notes, and snippets.

View MjHead's full-sized avatar

Andrew Shevchenko MjHead

  • Crocoblock
  • Ukraine
View GitHub Profile
@MjHead
MjHead / video-depends-from-options
Created June 22, 2015 08:21
Video size for video posts depends from options
function cherry_get_the_post_video() {
/**
* Filter post format video output to rewrite video from child theme or plugins.
*
* @since 4.0.0
*/
$result = apply_filters( 'cherry_pre_get_post_video', false );
if ( false !== $result ) {
return $result;
@MjHead
MjHead / add-font.php
Last active August 29, 2015 14:25
Add font to iconpicker
<?php
// Note! Replace 'themeXXXX' with your theme prefix
add_filter( 'cherry_custom_font_icons', 'themeXXXX_custom_font_icons' );
function themeXXXX_custom_font_icons($icons) {
$icons['themeXXXX_flat_icon'] = get_stylesheet_directory_uri() . '/assets/css/font-css-file.css';
return $icons;
}
@MjHead
MjHead / wrapper-footer.php
Created September 17, 2015 07:03
Commnet out part of columns from footer in Croconaw theme
<?php
/**
* Include custom options snippet
*/
add_action( 'after_setup_theme', 'themeXXXX_custom_options' );
function themeXXXX_custom_options() {
require_once CHILD_DIR . '/inc/class-cherry-child-custom-options.php';
<?php
/**
* Adding style attribute and class into row shortcode.
*
* Before using replace themeXXXX with your theme name.
*/
add_filter( 'cherry_shortcodes/data/shortcodes', 'themeXXXX_row_style_att', 100, 1 );
add_filter( 'shortcode_atts_row', 'themeXXXX_row_pass_style', 10, 3 );
add_filter( 'cherry_shortcodes_output_row_class', 'themeXXXX_row_pass_style_class', 10, 2 );
<?php
add_filter( 'cherry_shortcodes_output', 'themeXXXX_row_add_tags', 10, 3 );
/**
* Add custom markup inside row shortcode.
*
* @param string $output shortcode content.
* @param array $atts attributes array.
* @param string $shortcode shortcode name.
<?php
public function get_image( $photo ) {
$width = 100;
$height = 100;
$photo['image'] = str_replace( 's150x150', 's100x100', $photo['image'] );
return sprintf( '<a class="instagram__link" href="%s" target="_blank" rel="nofollow"><img class="instagram__img" src="%s" alt="" width="%s" height="%s"><span class="instagram__cover"></span></a>', esc_url( $photo['link'] ), esc_url( $photo['image'] ), $width, $height );
}
@MjHead
MjHead / sprintf.php
Last active August 17, 2016 14:39
sprintf example
return sprintf(
'<div class="info-block">%s</div><div class="info-block address"> <i class="material-icons">location_on</i>%s </div>',
__( 'If you can envision it, than we can build it!', 'builderry' ),
__( '11559 Ventura Boulevard, Studio City, CA 91604', 'builderry' )
);
// Admin footer modification
function remove_footer_admin ()
{
echo '<span id="footer-thankyou">Developed by <a href="http://www.designerswebsite.com" target="_blank">Your Name</a></span>';
}
add_filter('admin_footer_text', 'remove_footer_admin')