Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
thecodepoetry / functions.php
Created May 22, 2014 17:08
Portfolio navigation through same category for The7 -Mulltipurpose wordpress them
if ( ! function_exists( 'presscore_post_navigation' ) ) :
/**
* Next/previous post buttons helper.
*
* Works only in the loop. Sample options array:
* array(
* 'wrap' => '<div class="paginator-r inner-navig">%LINKS%</div>',
* 'title_wrap' => '<span class="pagin-info">%TITLE%</span>',
* 'no_link_next' => '<a href="#" class="prev no-act" onclick="return false;"></a>',
@thecodepoetry
thecodepoetry / functions.php
Last active August 29, 2015 14:07
WordPress search filters
//to exclude a custom post type
function remove_portfolio_search() {
global $wp_post_types;
$wp_post_types['dt_portfolio']->exclude_from_search = true;
}
add_filter('pre_get_posts','remove_portfolio_search');
//To exclude some specific post
add_filter( 'pre_get_posts', 'cp_filter_search' );
@thecodepoetry
thecodepoetry / functions.php
Last active August 29, 2015 14:08
Remove Theme options menu from admin bar
add_action( 'wp_before_admin_bar_render', 'remove_theme_options', 999 );
function remove_theme_options() {
if ( ! is_admin() ) {
global $wp_admin_bar;
$wp_admin_bar->remove_node('options-framework-parent'); //theme options
$wp_admin_bar->remove_node('presscore-icons-bar'); //icon bar
}
}
@thecodepoetry
thecodepoetry / default-template.php
Last active August 29, 2015 14:10
The7.2 event calender plugin fix
<?php
/**
* Default Events Template
* This file is the basic wrapper template for all the views if 'Default Events Template'
* is selected in Events -> Settings -> Template -> Events Template.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/default-template.php
*
* @package TribeEventsCalendar
*
@thecodepoetry
thecodepoetry / functions.php
Last active August 29, 2015 14:10
Add footer globally in The7.2, Armada
add_action( 'get_header', 'dt_global_footer', 10 );
function dt_global_footer() {
$config = Presscore_Config::get_instance();
$footer = $config->get( 'footer_show' );
if(!$footer) {
$config->set( 'footer_show', true );
@thecodepoetry
thecodepoetry / functions.php
Created December 9, 2014 09:43
Compatibility fix for tribe event calender plugin
add_action( 'get_header', 'tribe_event_fix', 10 );
function tribe_event_fix() {
if ( 'tribe_events' == get_post_type() ) {
$config = Presscore_Config::get_instance();
presscore_config_base_init();
}
}
@thecodepoetry
thecodepoetry / functions.php
Last active August 29, 2015 14:11
Add DT meta boxes to events page
function dt_add_event_metaboxes() {
global $DT_META_BOXES;
if ( $DT_META_BOXES ) {
foreach ( array( 'dt_page_box-sidebar', 'dt_page_box-footer', 'dt_page_box-header_options', 'dt_page_box-slideshow_options', 'dt_page_box-fancy_header_options' ) as $mb_id ) {
if ( isset($DT_META_BOXES[ $mb_id ], $DT_META_BOXES[ $mb_id ]['pages']) ) {
$DT_META_BOXES[ $mb_id ]['pages'][] = 'tribe_events';
}
@thecodepoetry
thecodepoetry / functions.php
Created December 30, 2014 09:13
Custom menu filter for The7.2, Armada
add_filter( 'dt_menu_options', 'cp_custom_menu_filter' );
function cp_custom_menu_filter( $options = array() ) {
global $post;
if ( 'primary' == $options['location'] ) {
if(is_page( 35 )) { //if page id 35
@thecodepoetry
thecodepoetry / functions.php
Last active August 29, 2015 14:12
Add sidebar in category archive page, Th7e.2, Armada
add_action( 'get_header', 'dt_archive_sidebar', 10 );
function dt_archive_sidebar() {
$config = Presscore_Config::get_instance();
if(is_archive() || is_category() ){
$config->set( 'sidebar_position', 'right' );
$config->set( 'sidebar_widgetarea_id', 'sidebar_1' );
}
@thecodepoetry
thecodepoetry / functions.php
Created January 6, 2015 14:26
Disable sidebar globally
add_action( 'get_header', 'dt_disable_sidebar', 10 );
function dt_disable_sidebar() {
$config = Presscore_Config::get_instance();
$config->set( 'sidebar_position', 'disabled' );
}