Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
thecodepoetry / functions.php
Last active September 18, 2019 07:33
The7 Secondary menu
function tcp_menu_shortcode($atts) {
extract(shortcode_atts(array( 'id' => null), $atts));
return presscore_nav_menu( array( 'menu' => $id, 'echo' => false, 'menu_id' => 'top-menu', 'container' => 'div', 'container_class' => 'mini-nav', 'submenu_class' => 'mini-sub-nav') );
}
add_shortcode('tcpmenu', 'tcp_menu_shortcode');
@thecodepoetry
thecodepoetry / functions.php
Created August 22, 2019 12:59
WC product loop title to h2
if ( ! function_exists( 'dt_woocommerce_template_loop_product_title' ) ) :
/**
* Show the product title in the product loop.
*/
function dt_woocommerce_template_loop_product_title() {
if ( presscore_config()->get( 'show_titles' ) && get_the_title() ) : ?>
<h2 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php echo the_title_attribute( 'echo=0' ); ?>" rel="bookmark"><?php
the_title();
@thecodepoetry
thecodepoetry / fucntions.php
Last active September 6, 2019 13:42
The7 excerpt length
function custom_excerpt_length( $excerpt ) {
if(!is_page( 2 ) && !is_page( 25 )) {
$length = 10; //adjust the number of words
$excerpt = wp_trim_words( $excerpt, $length );
}
return $excerpt;
}
add_filter( 'the_excerpt', 'custom_excerpt_length', 999 );
@thecodepoetry
thecodepoetry / functions.php
Last active September 19, 2019 06:07
list portfolio categories
function dt_portoflio_category_list() {
$terms = get_terms( array(
'taxonomy' => 'dt_portfolio_category',
'hide_empty' => true,
) );
$count = count( $terms );
if ( $count > 0 ) {
$cats = '<ul>';
<?php
// File Security Check.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$config = presscore_config();
$css = The7_Fancy_Title_CSS::get_css_for_post( $config->get( 'post_id' ) );
if ( $css ) {
echo '<style id="the7-fancy-title-css" type="text/css">' . "\n$css\n" . '</style>';
@thecodepoetry
thecodepoetry / fucntions.php
Created April 5, 2019 11:06
re arrnage produc rating - single product page
add_action( 'after_setup_theme', 'the7child_setup', 100 );
function the7child_setup() {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 5 );
}
@thecodepoetry
thecodepoetry / functions.php
Created April 5, 2019 10:59
Photos masnory grid - image order by date
add_action( 'init', function() {
class My_Shortcode_Override extends DT_Shortcode_GalleryMasonry {
protected function get_albums_attachments( $args = array() ) {
$post_type = $this->get_att( 'post_type' );
$defaults = array(
'orderby' => 'date',
'order' => 'DESC',
'number' => false,
'category' => array(),
@thecodepoetry
thecodepoetry / content-single-gallery.php
Created March 21, 2019 09:51
Album content above gallery
<script type="text/javascript" >
jQuery(document).ready(function($) {
$('.dt-my-button a').on("click", function(){
alert("dt-my-button menu was clicked.");
});
});
</script>
@thecodepoetry
thecodepoetry / functions.php
Created January 11, 2019 09:30
Page specific bottom menu
add_filter( 'presscore_nav_menu_args', 'bottom_menu_filter' );
function bottom_menu_filter( $args = array() ) {
$location = $args['theme_location'];
if( $location == 'bottom' ) {
if(is_page( 2 )) { //if page id 2
$page_menu = intval( 199 ); //display menu with id 199