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
Created May 22, 2014 17:12
Change sidebar position for woocommerce products for The7 -Mulltipurpose wordpress them
function change_sidebar_pos() {
$args = array (
'post_type' => 'product',
'post_per_page' => -1
);
query_posts( $args );
while ( have_posts() ) : the_post();
@thecodepoetry
thecodepoetry / functions.php
Last active June 29, 2016 11:16
un register custom post type in the7 theme
if ( !class_exists('Presscore_Inc_Testimonials_Post_Type') ) {
class Presscore_Inc_Testimonials_Post_Type {
public static function register() {
return;
}
}
}
@thecodepoetry
thecodepoetry / functions.php
Last active January 4, 2023 17:37
Change portfolio breadcrumb archive link to your custom portfolio page
add_filter( 'post_type_archive_link', 'my_portfolio_archive_link', 10, 1 );
function my_portfolio_archive_link( $archivelink ) {
if( get_post_type() == 'dt_portfolio') {
return get_permalink( 382 ); //replace 382 with id of your portfolio page
}
else {
return $archivelink;
@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 / functions.php
Last active March 24, 2021 07:43
To change default pre selected sidebar position in The7 and Armada
function dt_change_default_sidebar() {
global $DT_META_BOXES;
if ( $DT_META_BOXES ) {
if ( isset($DT_META_BOXES[ 'dt_page_box-sidebar' ]) ) {
$DT_META_BOXES[ 'dt_page_box-sidebar' ]['fields'][0]['std'] = 'left'; // use disabled to disable sidebar
}
@thecodepoetry
thecodepoetry / functions.php
Last active December 22, 2017 12:52
Login logout link The7 topbar menu
function the7_login_logout_link( $items, $args ) {
if( $args->theme_location == 'top' ) {
$loglink ="";
if ( ! is_user_logged_in() )
$loglink .= '<li class="menu-item menu-item-type-custom menu-item-object-custom"><a href="' . esc_url( wp_login_url() ) . '"><span class="menu-item-text"><span class="menu-text">Login</span></span></a>';
else
$loglink .= '<li class="menu-item menu-item-type-custom menu-item-object-custom"><a href="' . esc_url( wp_logout_url() ) . '"><span class="menu-item-text"><span class="menu-text">Logout</span></span></a>';
$items = $loglink.$items;
}
return $items;
@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 );