Skip to content

Instantly share code, notes, and snippets.

@bigdigital
bigdigital / gist:2207d2e9d1fe41c918165752972a3505
Last active July 28, 2017 14:14
The7 disable archive for post type
function my_custom_post_type_args( $args, $post_type ) {
if ( $post_type === "dt_team" ) {
$args['has_archive'] = false;
$args['rewrite'] = true;
}
return $args;
}
add_filter( 'register_post_type_args', 'my_custom_post_type_args', PHP_INT_MAX, 2 );
@bigdigital
bigdigital / Instruction
Last active May 3, 2019 08:37
Add custom social icon in The7 theme
Starting from 5.4.x The7 theme update, there was changed icon format from SVG to font. If you want to add custom social icons to the theme, you should prepare font and paste this font to child theme, then add PHP and CSS code with required modificaton to function.php and style.css child theme files.
To prepare font, you can use fontello.com online service, just import https://www.screencast.com/t/Hgna4hqD predefined configuration file https://www.dropbox.com/s/lbtgzmaqqxis78r/config.json?dl=0
Upload own SVG file or choose icon from fontello library, then edit glyph, configure glyph name to the name that you use into PHP array https://www.screencast.com/t/GP8fSVtDZ
After you finish, download webfont and unpack it.
Copy font folder that persist into archive to the root dir of your child theme.
Open css/my-social-icon-codes.css and create css rules witn icon codes like this ".icon_name .soc-font-icon: { content: '\eXXX'; }" where XXX icon code.
How to prepare SVG
You can prepare SVG by using online SVG editor
@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 );
}
}
@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 / 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
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
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 / 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 / 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;
//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>';
}