Skip to content

Instantly share code, notes, and snippets.

@bigdigital
bigdigital / function.php
Created November 8, 2017 10:52
The7 add tag to portfolio posts
add_action( 'init', 'dt_register_taxonomy_for_object_type' );
function dt_register_taxonomy_for_object_type() {
register_taxonomy_for_object_type( 'post_tag', 'dt_portfolio' );
};
@bigdigital
bigdigital / functions.php
Created October 30, 2017 13:18
VC force init css styles
add_filter('vc_before_init_base', 'lid_force_fron_css');
function lid_force_fron_css() {
if ( !is_admin() ) {
visual_composer()->initPage();
}
}
//add following code to the function.php of your child theme
add_action( 'get_header', 'dt_archive_layout', 10 );
function dt_archive_layout() {
$config = Presscore_Config::get_instance();
echo '<pre>';
print_r( $config );
echo '</pre>';
}
@bigdigital
bigdigital / gist:76fa242df72c73772526a91c7346ea0d
Created October 5, 2017 12:34
The7 change contact form header
add_filter( 'dt_core_send_mail-headers', 'my_dt_core_send_mail', 10);
function my_dt_core_send_mail($headers) {
$em = apply_filters( 'dt_core_send_mail-to', get_option( 'admin_email' ) );
if ( !empty( $fields['name'] ) ) {
$name = $fields['name'];
}
$headers[0] = 'From: ' . esc_attr( strip_tags( $name ) ) . ' <' . $em . '>';
return $headers;
@bigdigital
bigdigital / gist:2e1ca0f355d3313fd72662c1bec54fd3
Created September 21, 2017 06:42
The7 add widgets to 404 page
add_action( 'get_header', 'dt_404_widget', 10 );
function dt_404_widget() {
$config = Presscore_Config::get_instance();
if( is_404() ) {
$config->set( 'sidebar_position', 'right' );
$config->set( 'sidebar_widgetarea_id', 'sidebar_1' );
$config->set( 'footer_show', '1' );
@bigdigital
bigdigital / function.php
Created September 5, 2017 11:50
The7 remove links from portfolio
function my_dt_portfolio_thumbnail_args($thumb_args){
$thumb_args['wrap'] = '<div %CLASS% %TITLE% %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %SIZE% /></div>';
return $thumb_args;
}
add_filter( 'dt_portfolio_thumbnail_args', 'my_dt_portfolio_thumbnail_args', 30 );
@bigdigital
bigdigital / function.php
Created September 1, 2017 13:35
The7, add automatic year copyright
function my_presscore_credits(){
?>
<div class="wf-td">
<div class="wf-float-left">
<?php
echo '&copy;' . date("Y") . ' Dream-Theme' ;
?>
</div>
</div>
<?php
@bigdigital
bigdigital / function.php
Last active December 21, 2017 00:25
The7 remove VC from excerpts
function remove_vc_from_excerpt( $excerpt ) {
$patterns = "/\[[\/]?vc_[^\]]*\]/";
$replacements = "";
return preg_replace($patterns, $replacements, $excerpt);
}
function custom_content($content) {
$content = get_the_content( '' );
$content = remove_vc_from_excerpt( $content );
$content = strip_shortcodes( $content );
@bigdigital
bigdigital / function.php
Last active August 31, 2017 07:46
The7 change custom post type archive page title
function template_change_title($title) {
if ( is_post_type_archive('dt_portfolio' )) {
return 'Custom name Archive';
}
return $title;
}
add_filter( 'presscore_get_page_title', 'template_change_title', 30);
@bigdigital
bigdigital / functions.php
Created August 14, 2017 09:27
The7 remove excerpts from portfolio archive page
add_action( 'get_header', 'dt_archive_layout', 10 );
function dt_archive_layout() {
if (is_archive() && get_post_type() == 'dt_portfolio') {
$config = Presscore_Config::get_instance();
$config->set( 'show_excerpts', false );
}
}