Skip to content

Instantly share code, notes, and snippets.

@shazdeh
shazdeh / gist:7413003
Last active December 28, 2015 00:19
Custom tile colors. Create custom colors for tile post types (Metro theme).
<?php
function custom_themify_theme_meta_boxes($arg) {
array_push($arg[4]['options'][1]['meta'], array('value' => 'cyan', 'img' => 'images/layout-icons/color-cyan.png'));
array_push($arg[4]['options'][1]['meta'], array('value' => 'silvergrape', 'img' => 'images/layout-icons/color-silvergrape.png'));
return $arg;
};
add_filter( 'themify_do_metaboxes', 'custom_themify_theme_meta_boxes' );
@shazdeh
shazdeh / gist:7413631
Last active December 28, 2015 00:29
Moving up the sidebar beside the content area in Bold theme's single view
.single #body {
position: relative;
width: 978px;
margin: auto;
}
.single .post-inner {
margin-right: 240px;
}
.single #layout {
position: absolute;
@shazdeh
shazdeh / gist:7454541
Created November 13, 2013 19:08
Add a transparent overlay on top of Flatshop product backgrounds. Kudos to Christian!
.products .product:before,
.single .product-single-top:before {
content: " ";
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: rgba(255,255,255,.4);
z-index: 1;
@shazdeh
shazdeh / gist:7483479
Created November 15, 2013 12:19
Custom chart options (Flat theme)
<?php
function custom_chart_vars( $options ) {
return array(
'trackColor' => '#f2f2f2',
'scaleColor' => false,
'lineCap' => 'butt',
'rotate' => 0,
'size' => 170,
'lineWidth' => 22,
@shazdeh
shazdeh / gist:7497914
Created November 16, 2013 09:12
WPML utility function to get an array of post translation (also includes the original language)
<?php
function wmpl_get_post_translations( $post_id = null ) {
global $post, $sitepress;
if( ! isset( $post_id ) )
$post_id = $post->ID;
$post = get_post( $post_id );
$trid = $sitepress->get_element_trid( $post_id, 'post_' . $post->post_type );
@shazdeh
shazdeh / gist:7533822
Created November 18, 2013 19:29
Move meta info to the bottom of the post in Elemin
.list-post .post-meta {
top: 100%;
width: 100%;
text-align: left;
}
.list-post .post-meta span,
.post-meta .post-date {
display: inline-block;
margin-right: 10px;
}
@shazdeh
shazdeh / gist:7534976
Created November 18, 2013 20:44
Enable the right sidebar on single portfolio pages (Parallax)
<?php
function custom_body_classes( $classes ) {
if( is_singular( 'portfolio' ) ) {
$id = array_search( 'sidebar-none', $classes );
unset( $classes[$id] );
$classes[] = 'sidebar1';
}
return $classes;
@shazdeh
shazdeh / gist:7546005
Created November 19, 2013 14:15
Custom tile sizes (Metro)
<?php
function register_custom_tile_size( $args ) {
$args[4]['options'][0]['meta'][] = array( 'value' => 'custom', 'img' => 'images/layout-icons/tile-custom.png', 'title' => __( 'Custom', 'themify' ) );
return $args;
}
add_filter( 'themify_do_metaboxes', 'register_custom_tile_size' );
@shazdeh
shazdeh / gist:7580292
Last active December 28, 2015 23:39
logo between top two menus (Magazine)
#headerwrap {
background: none;
}
#header {
background: #0e88be;
width: auto;
margin-top: 180px; /* equal to the height of the logo */
}
@media (min-width: 781px) {
#sidr {
@shazdeh
shazdeh / gist:7631477
Last active December 29, 2015 06:49
Accordion shortcode. It uses Builder's default output. Example: [accordion][accordion_item title="Title 1"]Panel 1 content[/accordion_item][accordion_item title="Title 2"]Panel 2 content[/accordion_item][/accordion]
<?php
function custom_themify_accordion_shortcode( $atts, $content = '' ) {
$class = isset( $atts['style'] ) ? $atts['style'] : '';
$output = '<div class="module module-accordion"><ul class="ui module-accordion '. $class .'">';
$output .= do_shortcode( $content );
$output .= '</ul></div>';
return $output;
}
add_shortcode( 'accordion', 'custom_themify_accordion_shortcode' );