Skip to content

Instantly share code, notes, and snippets.

@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: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: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: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: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:7376005
Last active December 27, 2015 19:19
Left align the header elements in Parallax theme
#site-logo,
#site-description,
.social-widget,
#header #searchform {
text-align: left;
text-indent: 5%;
margin-left: 0;
}
.widget.themify-social-links {
text-indent: 0;
@shazdeh
shazdeh / gist:7367465
Created November 8, 2013 07:28
Content widget areas. Registers two widget areas that are displayed above and below the main content area.
<?php
add_action( 'widgets_init', 'register_content_widget_areas' );
add_action( 'themify_content_start', 'display_content_top_area' );
add_action( 'themify_content_end', 'display_content_bottom_area' );
function register_content_widget_areas() {
register_sidebar(array(
'name' => __( 'Content Top' ),
'id' => 'content-top',
@shazdeh
shazdeh / gist:7354290
Last active December 27, 2015 16:19
Clean accordion style. Removes the default styles of the accordion modules in Builder.
.module.module-accordion.clean,
.module.module-accordion.clean ul,
.module.module-accordion.clean li,
.module.module-accordion.clean .accordion-title,
.module.module-accordion.clean li:hover .accordion-title,
.module.module-accordion.clean .accordion-content,
.module.module-accordion.clean li.current,
.module.module-accordion.clean li.current .accordion-content {
background: none;
border: none;
@shazdeh
shazdeh / gist:7343690
Created November 6, 2013 20:40
Display a gallery in lightbox! Cool effect.
<a class="lightbox" href="#gallery1" rel="prettyPhoto"> Open Gallery </a>
<div id="gallery1" style="display: none;">
<!-- add the [gallery] shortcode here -->
</div>
@shazdeh
shazdeh / gist:7341755
Last active December 27, 2015 14:39
Simple dropdowns using the Custom Menu widget
.menu > li {
display: inline-block;
position: relative;
}
.menu > li > a {
padding: 5px 10px;
display: inline-block;
}
.menu li ul {
display: none;