Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
thecodepoetry / custom.js
Created May 7, 2024 04:29
RS countdown
var countDownDate = new Date("july 01, 2024 15:37:25").getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get today's date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
<script>
jQuery(document).ready(function($) {
var delay = 300;
setTimeout(function() {
$('.the7-e-tab-title').removeClass('active');
$('.the7-e-tab-text-content').removeClass('active');
$('.the7-e-tab-text-content').css('display', 'none'); }, delay);
});
</script>
@thecodepoetry
thecodepoetry / functions.php
Created September 29, 2022 07:56
Add addtinal parmaters to The7 CPT builder
add_filter( 'cptui_user_supports_params', function( $supports, $post_type ) {
if ( $post_type === 'movies' ) {
$supports['hierarchical'] = true;
}
return $supports;
}, 10, 2 );
@thecodepoetry
thecodepoetry / functions.php
Created July 6, 2022 05:51
Add album gallery images to REST API
add_action( 'rest_api_init', 'add_album_gallery_fields' );
function add_album_gallery_fields() {
register_rest_field(
'dt_gallery',
'album_gallery',
array(
'get_callback' => 'get_album_gallery', // custom function name
'update_callback' => null,
'schema' => null,
)
@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' );
<?php
/**
* Classic layout.
*
* @package The7pt
*/
defined( 'ABSPATH' ) || exit;
$rollover_class = '';