Skip to content

Instantly share code, notes, and snippets.

@bigdigital
bigdigital / functions.php
Last active February 5, 2017 09:57
The7 theme breadcrumbs integration under the main menu
//put in in functions.php in main or child theme
//add breadrums to main menu
function custom_breadcrumbs() {
$config = Presscore_Config::get_instance();
// get breadcrumbs
if ( $config->get( 'page_title.breadcrumbs.enabled' ) ) {
$breadcrumbs = presscore_get_page_title_breadcrumbs();
} else {
$breadcrumbs = '';
@bigdigital
bigdigital / functions.php
Last active June 15, 2017 16:39
Add custom social icon in The7 theme
//add this code to main or child functions.php file
function presscore_get_social_icons_data() {
return array(
'facebook' => __('Facebook', 'the7mk2'),
'twitter' => __('Twitter', 'the7mk2'),
'google' => __('Google+', 'the7mk2'),
'dribbble' => __('Dribbble', 'the7mk2'),
'you-tube' => __('YouTube', 'the7mk2'),
'rss' => __('Rss', 'the7mk2'),
'delicious' => __('Delicious', 'the7mk2'),
@bigdigital
bigdigital / functions.php
Created January 31, 2017 15:45
Custom redirect after comment posted in wordpress
add_action('comment_post_redirect', 'redirect_after_comment');
function redirect_after_comment() {
return 'http://example.com';
}
.service .btn {
background: none repeat scroll 0 0 transparent;
border: none !important;
color: #FFC229;
font-size: 3em;
position: absolute;
width: 100%;
height: 100%;
top: 0 !important;
left: 0 !important;
@bigdigital
bigdigital / functions.php
Last active February 6, 2017 08:32
Add custom post type search in wordpress
<?php
add_filter( 'pre_get_posts', 'custom_post_search' );
function custom_post_search( $query ) {
$post_type = get_query_var('post_type');
if ( $query->is_search && !is_admin() ) {
$query->set( 'post_type', array( 'post', 'movies', 'products', 'portfolio', 'ai1ec_event' ) );
}
else if ( $query->is_search && is_admin() && $post_type == 'ai1ec_event' ){
$query->set( 'post_type', array( 'ai1ec_event' ) );
@bigdigital
bigdigital / functions.php
Created February 2, 2017 09:36
Wordpress redirect 404 error to custom page
function custom_404_page_redirect() {
global $wp_query;
if ($wp_query->is_404) {
wp_redirect('http://example.com',301);
exit;
}
}
add_action('wp', 'custom_404_page_redirect', 1);
@bigdigital
bigdigital / functions.php
Last active February 6, 2017 12:44
Change metabox defaults The7
function dt_change_metabox_defaults() {
global $DT_META_BOXES;
if ( $DT_META_BOXES ) {
$box_album_options = null;
//find dt_page_box-album_options
foreach($DT_META_BOXES as &$value) {
if ($value['id'] === 'dt_page_box-album_options') {
$box_album_options = &$value;
@bigdigital
bigdigital / review-orded.php
Created February 2, 2017 17:00
Add thumbnail in woocomerce reiview order
<?php
/**
* Review order table
*
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/review-order.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@bigdigital
bigdigital / function.php
Last active October 9, 2020 13:24
Add SVG as logo in The7 theme
//to able to use svg you can install following plugin https://uk.wordpress.org/plugins/svg-support/
function presscore_get_logo_image( $logos = array(), $class = '' ) {
if ( ! is_array( $logos ) ) {
$logos = array( $logos );
}
// get default logo
foreach ( $logos as $logo ) {
if ( $logo ) {
@bigdigital
bigdigital / functions.php
Created February 10, 2017 19:26
Redefine page titles in The7 (work since 4.2.1)
//put this function in your main or child theme function.php
function redefine_page_title($default_page_title_strings)
{
$my_page_title_strings = array(
'search' => __( 'Search Results for: %s', 'the7mk2' ),
'category' => __( 'Category Archives: %s', 'the7mk2' ),
'tag' => __( 'Tag Archives: %s', 'the7mk2' ),
'author' => __( 'Author Archives: %s', 'the7mk2' ),
'day' => __( 'Daily Archives: %s', 'the7mk2' ),
'month' => __( 'Monthly Archives: %s', 'the7mk2' ),