Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
thecodepoetry / fucntions.php
Last active February 18, 2021 14:13
enable display full content for portoflio tag arhive
add_filter('the7_archive_display_full_content', 'archive_template_for_port_tax',10, 1);
function archive_template_for_port_tax( $display_full_content ) {
if( is_tax( 'dt_portfolio_tags' ) ) {
$display_full_content = true;
}
return $display_full_content;
}
@thecodepoetry
thecodepoetry / fucntions.php
Created January 28, 2021 04:01
Custom search for shortcode only for post
function cpsearchform( $form ) {
$form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
<div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
<input type="text" value="' . get_search_query() . '" name="s" id="s" />
<input type="hidden" name="post_type" value="post" />
<input type="submit" id="searchsubmit" class="dt-btn" value="'. esc_attr__('Search') .'" />
</div>
</form>';
@thecodepoetry
thecodepoetry / fucntions.php
Created December 25, 2020 11:18
Display logged user name shortcode
function dt_display_username_func( $atts ){
if(is_user_logged_in()) {
global $current_user;
return 'Welcome: ' . $current_user->display_name;
}
else return;
}
add_shortcode( 'username', 'dt_display_username_func' );
@thecodepoetry
thecodepoetry / fucntions.php
Created December 14, 2020 10:25
Prev next reverse in Album photoscroller
function presscore_get_previous_post_link( $link_text = '', $link_class = '', $dummy = '' ) {
$post_link = get_next_post_link( '%link', $link_text );
if ( $post_link ) {
return str_replace( 'href=', 'class="'. esc_attr( $link_class ) . '" href=', $post_link );
}
return $dummy;
}
function presscore_get_next_post_link( $link_text = '', $link_class = '', $dummy = '' ) {
@thecodepoetry
thecodepoetry / fucntions.php
Created December 4, 2020 09:56
Add Billing and Additonal info header in WC checkout
add_action( 'woocommerce_before_checkout_billing_form', 'dt_wc_billing_header', 10 );
function dt_wc_billing_header() {
if ( wc_ship_to_billing_address_only() && WC()->cart->needs_shipping() ) : ?>
<h3><?php esc_html_e( 'Billing &amp; Shipping', 'woocommerce' ); ?></h3>
<?php else : ?>
@thecodepoetry
thecodepoetry / fucntions.php
Last active October 9, 2020 11:06
Share buttons shortcode
function share_func( $atts ){
$share_buttons = the7_get_share_buttons_list( 'post');
if ( apply_filters( 'presscore_hide_share_buttons', empty( $share_buttons ) ) ) {
return;
}
if ( 'on_hover' === of_get_option( 'social_buttons-visibility' ) ) {
$wrap_class .= ' show-on-hover';
}
@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 / 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
Created April 2, 2020 10:57
Change page title to h2
add_filter( 'presscore_page_title', 'dt_set_page_title_to_h2_filter' );
function dt_set_page_title_to_h2_filter( $title ) {
return str_replace( array( '<h1', '</h1' ), array( '<h2', '</h2' ), $title );
}
@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
*/