Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / function.php
Created July 13, 2017 09:09
Remove Nofollow Link in The7
function my_filter_presscore_post_details_link( $output ){
$output = str_replace( 'rel="nofollow"', '' ,$output);
return $output;
}
add_filter( 'presscore_post_details_link', 'my_filter_presscore_post_details_link' );
@bigdigital
bigdigital / gist:a7523a1365877d064967ff24cef8afa2
Created July 11, 2017 14:04
change default portfolio metaboxed in The7
function dt_change_default_metabox() {
global $DT_META_BOXES;
if ( $DT_META_BOXES ) {
foreach ( $DT_META_BOXES as $key => $DT_META_BOX ) {
if (key_exists('id',$DT_META_BOX ) && ($DT_META_BOX['id'] === 'dt_page_box-portfolio_post_media_options') )
{
$DT_META_BOXES[ $key ]['fields']['0']['std'] = 'before';
@bigdigital
bigdigital / functions.php
Last active June 28, 2017 08:21
The7 Add standard page title after slide page title
function custom_presscore_do_header_slideshow( $title ) {
$id = get_the_ID();
$myPostId = 36444;
if ($id !== $myPostId ) return;
$config = Presscore_Config::get_instance();
if ( 'slideshow' != $config->get('header_title') ){
return;
}
$config->set( 'page_title.breadcrumbs.enabled', true );
$config->set( 'header_title', 'enabled' );
function add_after_head() {
?>
<meta name="google-site-verification" content="PLACE HERE MY CODE" />
<?php
}
add_action( 'wp_head', 'add_after_head' );
@bigdigital
bigdigital / functions.php
Last active June 20, 2017 11:58
The7, add script before the end of your closing body tag </body>
add_action( 'wp_footer', function () { ?>
<script src="//lcp360.cachefly.net/panoskin.min.js"></script>
<script>
PANOSKIN.createViewer({
id: 'pano',
tour: 'TOUR-ID' /* Replace TOUR-ID with your tour's ID */
});
</script>
<?php } );
@bigdigital
bigdigital / fuction.php
Last active June 28, 2017 12:59
The7 Handle portfolio archive pages
add_filter( 'presscore_config_post_id_filter', 'dt_portfolio_archive_id_filter' );
function dt_portfolio_archive_id_filter($new_post_id) {
if (is_post_type_archive('dt_portfolio'))
{
$new_post_id = 84; //replace this to template post id
}
return $new_post_id;
}
@bigdigital
bigdigital / gist:8b443fb78d1487812b7b616fcfc4a52c
Created June 14, 2017 11:21
The7 add JS/ HTML to footer
// Add scripts to wp_footer()
function child_theme_footer_script() { ?>
<!-- Your JS/HTML goes here -->
<?php }
add_action( 'wp_footer', 'child_theme_footer_script' );
@bigdigital
bigdigital / functions.php
Created June 2, 2017 06:14
Woocommerce, remove Product Sales Icon
add_filter('woocommerce_sale_flash', 'woo_custom_hide_sales_flash');
function woo_custom_hide_sales_flash()
{
return false;
}