Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
thecodepoetry / fucntions.php
Created April 7, 2020 13:06
Next prev throug same category for post and portfolio
function presscore_new_post_navigation( $args = array() ) {
if ( ! in_the_loop() ) {
return '';
}
$defaults = array(
'prev_src_text' => __( 'Previous post:', 'the7mk2' ),
'next_src_text' => __( 'Next post:', 'the7mk2' ),
'in_same_term' => false,
'excluded_terms' => '',
@thecodepoetry
thecodepoetry / fucntions.php
Last active November 1, 2021 13:50
RTL Child theme
if ( is_rtl() ) {
add_action(
'wp_enqueue_scripts',
function () {
wp_enqueue_style( 'the7-parent-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
},
10
);
}
@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 / mod-wc-template-functions.php
Created November 21, 2018 09:09
WC 3.5 fix for Aramda
<?php
// File Security Check
if ( ! defined( 'ABSPATH' ) ) { exit; }
if ( ! function_exists( 'woocommerce_pagination' ) ) {
/**
* Output the pagination.
* (override)
*
@thecodepoetry
thecodepoetry / rtl.css
Last active July 27, 2021 07:02
The7 rtl.css
/*
Theme Name: The7
Adding support for language written in a Right To Left (RTL) direction is easy -
it's just a matter of overwriting all the horizontal positioning attributes
of your CSS stylesheet in a separate stylesheet file named rtl.css.
http://codex.wordpress.org/Right_to_Left_Language_Support
*/
@thecodepoetry
thecodepoetry / functions.php
Created July 15, 2021 04:36
Disable team arhive page
add_filter( 'presscore_post_type_dt_team_args', 'my_team_args' );
function my_team_args( $args ) {
$args['has_archive'] = false ;
return $args;
}
@thecodepoetry
thecodepoetry / functions.php
Last active July 12, 2021 11:09
To display team details and social link on single team page using shortcode
function teamposition_func( $atts ){
$config = presscore_config();
presscore_populate_team_config();
$position = $config->get( 'post.member.position' );
if($position) {
return '<p>'.$position.'<p>';
}
}
add_shortcode( 'teamposition', 'teamposition_func' );
@thecodepoetry
thecodepoetry / functions.php
Created April 26, 2021 17:36
Disable page title CPT
add_action( 'get_header', 'dt_disable_header', 10 );
function dt_disable_header() {
$config = Presscore_Config::get_instance();
if( is_singular( 'cpt_name' ) ) {
$config->set( 'header_title', 'disabled' );
}
}
@thecodepoetry
thecodepoetry / functions.php
Created April 9, 2021 13:50
telgram share button
add_filter( 'the7_get_share_buttons_list', 'dt_add_sharebtn_callback', 10, 4);
function dt_add_sharebtn_callback( $share_buttons, $place, $post_id, $buttons ) {
$title = get_the_title($post_id );
$url = get_the_permalink($post_id );
$url = 'https://t.me/share/url?url="'. $url . '"&text=' . $title;
$share_buttons[] = array(
'id' => 'telegram',
'url' => $url,
@thecodepoetry
thecodepoetry / functions.php
Last active March 25, 2021 13:48
load jquery-mousewheel locally
function dt_jquery_mousewheel_local() {
wp_enqueue_script( 'jquery-mousewheel', get_stylesheet_directory_uri() . '/js/jquery.mousewheel.min.js', array( 'jquery' ) );
}
add_action( 'wp_enqueue_scripts', 'dt_jquery_mousewheel_local' );