Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
thecodepoetry / fucntions.php
Last active June 14, 2023 04:40
Blog post Next Prev through same category V17
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 / functions.php
Last active May 26, 2023 10:34
Display tags single portfolio portfolio - The7
function add_portfolio_tags_after_post($content){
if (is_single() && 'dt_portfolio' == get_post_type() ) {
$tags = get_the_term_list( get_the_ID(), 'dt_portfolio_tags', '', '', '');
$content .= '<div class="entry-tags">'.$tags.'</div>';
}
return $content;
}
<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
Last active January 4, 2023 17:37
Change portfolio breadcrumb archive link to your custom portfolio page
add_filter( 'post_type_archive_link', 'my_portfolio_archive_link', 10, 1 );
function my_portfolio_archive_link( $archivelink ) {
if( get_post_type() == 'dt_portfolio') {
return get_permalink( 382 ); //replace 382 with id of your portfolio page
}
else {
return $archivelink;
@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 27, 2015 12:31
Portfolio category slug
add_filter( 'presscore_taxonomy_dt_portfolio_category_args', 'my_portfolio_category_slug' );
function my_portfolio_category_slug( $taxonomy_args ) {
$taxonomy_args['rewrite'] = array('slug' => 'my-portfolio-category');
return $taxonomy_args;
}
@thecodepoetry
thecodepoetry / functions.php
Created January 25, 2016 12:12
change testimonial slug from child theme
add_filter( 'presscore_post_type_dt_testimonials_args', 'my_testimonials_slug' );
function my_testimonials_slug( $args ) {
$args['rewrite'] = array('slug' => 'mytestimslug');
return $args;
}
@thecodepoetry
thecodepoetry / functions.php
Last active April 22, 2022 09:07
Prev next in reverse order
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
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' => '',