Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
thecodepoetry / functions.php
Last active March 22, 2018 21:06
Dynamic page layout management
add_action( 'get_header', 'dt_archive_layout', 10 );
function dt_archive_layout() {
$config = Presscore_Config::get_instance();
if( is_archive() || is_category() || is_search() ){
$config->set( 'template.columns.number', '5' );
$config->set( 'post.preview.width.min', '200' );
$config->set( 'image_layout', 'resize' );
@thecodepoetry
thecodepoetry / functions.php
Last active August 29, 2015 14:15 — forked from imemohit/functions.php
Product sidebar global edit
add_action( 'get_header', 'dt_product_sidebar', 10 );
function dt_product_sidebar() {
$config = Presscore_Config::get_instance();
if(is_product() ){
$config->set( 'sidebar_position', 'right' );
$config->set( 'footer_widgetarea_id', 'sidebar_1' );
}
@thecodepoetry
thecodepoetry / bbfix.php
Last active November 10, 2017 13:17
buddypress fix
add_action( 'get_header', 'dt_buddypress_template_config', 10 );
function dt_buddypress_template_config() {
$config = Presscore_Config::get_instance();
if( bp_current_component() ){
$config->set( 'sidebar_position', 'disabled' );
$config->set( 'footer_show', '0' );
@thecodepoetry
thecodepoetry / functions.php
Last active August 29, 2015 14:16
bbpress fix
function dt_buddypress_template_config() {
if( bbp_is_single_user() ){
$pagid = 35215; //sidebar, footer settings of the page id given will be applied to user profiles
$config = presscore_get_config( );
presscore_config_base_init( $pagid );
}
}
add_action( 'get_header', 'dt_buddypress_template_config', 10 );
@thecodepoetry
thecodepoetry / function.php
Created March 31, 2015 12:43
Load main.js from child theme
function custom_enq_childminjs() {
wp_dequeue_script( 'dt-main', get_template_directory_uri() . '/js/main.js', array( 'jquery' ), false, true );
wp_register_script('dt-main', get_stylesheet_directory_uri() . '/js/main.js', array('jquery'),false, true);
wp_enqueue_script('dt-main');
}
add_action( 'wp_enqueue_scripts', 'custom_enq_childminjs' );
@thecodepoetry
thecodepoetry / functions.php
Last active May 26, 2023 10:34
Display tags single portfolio portfolio - The7
function add_portfolio_tags_after_post($content){
if (is_single() && 'dt_portfolio' == get_post_type() ) {
$tags = get_the_term_list( get_the_ID(), 'dt_portfolio_tags', '', '', '');
$content .= '<div class="entry-tags">'.$tags.'</div>';
}
return $content;
}
@thecodepoetry
thecodepoetry / 1.php
Created April 7, 2015 13:36
Add to cart button on shop
//add this code in functions.php
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
//and add this rule in Theme options > General > CUstom CSS
.project-list-content a.add_to_cart_button:after {
display: none;
}
function presscore_top_bar_contact_element( $element ){
$white_list = array(
'address',
'phone',
'email',
'skype',
'clock'
);
if ( in_array($element, $white_list) ) {
@thecodepoetry
thecodepoetry / bbpress.php
Last active October 27, 2017 15:15
bbpress
function dt_bbypress_template_config() {
if( is_bbpress() )
{
$config->set( 'sidebar_position', 'right' );
$config->set( 'sidebar_widgetarea_id', 'sidebar_1' );
}
}
add_action( 'get_header', 'dt_bbypress_template_config', 10 );
@thecodepoetry
thecodepoetry / gist:6c93d2f988c6a8c56b52
Created April 27, 2015 10:16
variable-product-icons
.product_type_variable:after {
background-image: url("data:image/svg+xml,%3Csvg%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20x=%220px%22%20y=%220px%22%20width=%2224px%22%20height=%2224px%22%20viewBox=%220%200%2024%2024%22%20enable-background=%22new%200%200%2024%2024%22%20fill=%22white%22%20xml:space=%22preserve%22%3E%3Cpath%20d=%22M2.053,13.145h5.746v3.332H5.892v4.506H3.96v-4.506H2.053V13.145z%20M9.152,11.577h1.907v9.405h1.931v-9.405h1.908V8.245H9.152V11.577z%20M12.989,3.018h-1.931v3.778h1.931V3.018z%20M21.947,13.154h-5.744v3.332h1.906v4.496h1.932v-4.496h1.906V13.154z%20M5.892,3.018H3.96v8.677h1.932V3.018z%20M20.041,3.018h-1.932v8.677h1.932V3.018z%22/%3E%3C/svg%3E");
}