Skip to content

Instantly share code, notes, and snippets.

@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
*/
<wpml-config>
<shortcodes>
<shortcode>
<tag>dt_fancy_title</tag>
<attributes>
<attribute>title</attribute>
</attributes>
</shortcode>
<shortcode>
<tag>dt_quote</tag>
function the7searchform( $form ) {
$form = '<form class="searchform" role="search" method="get" action="'.esc_url( home_url( "/" ) ).'">
<label for="the7-search" class="screen-reader-text">'.esc_html( "Search:", "the7mk2" ).'</label>
<input type="text" id="the7-search" class="field searchform-s" name="s" value="'.esc_attr( get_search_query() ).'" placeholder="'.esc_attr( "Type and hit enter …", "the7mk2" ).'" />
<input type="submit" type="submit" id="searchsubmit" value="'.esc_attr( "Search!", "the7mk2" ).'" class="searchsubmit default-btn-shortcode dt-btn dt-btn-s link-hover-off btn-inline-left " style="position:absolute;" />
</form>';
return $form;
@thecodepoetry
thecodepoetry / fucntions.php
Created February 4, 2020 07:25
Add new share buttons
function new_share_email($share_buttons, $place, $post_id, $buttons){
$url = get_permalink( $post_id );
$title = isset( $_post->post_title ) ? $_post->post_title : '';
$share_buttons[] = array(
'id' => 'email' ,
'url' => 'mailto:?subject=I wanted you to see this site&amp;body=' . $title . ' ' . $url,
'name' => 'Email',
function the7_shortcodeaware_excerpt_filter( $output ) {
global $post;
if ( empty( $output ) && ! empty( $post->post_content ) ) {
add_filter( 'strip_shortcodes_tagnames', 'the7_shortcodes_to_strip_from_auto_exerpt' );
add_filter( 'strip_shortcodes_tagnames', 'rcb_shortcodes_to_strip_from_auto_exerpt' );
$content = strip_shortcodes( $post->post_content );
remove_filter( 'strip_shortcodes_tagnames', 'the7_shortcodes_to_strip_from_auto_exerpt' );
remove_filter( 'strip_shortcodes_tagnames', 'rcb_shortcodes_to_strip_from_auto_exerpt' );
@thecodepoetry
thecodepoetry / header-single.php
Created November 26, 2019 05:29
Enable pinch zoom for moble
<?php
/**
* Template part with actual header.
*
* @since 1.0.0
*
* @package The7\Templates
*/
defined( 'ABSPATH' ) || exit;
@thecodepoetry
thecodepoetry / functiopns.php
Created November 22, 2019 05:58
add code to header on specfic page
function add_after_head() {
if ( is_page('231') ) {
?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->
@thecodepoetry
thecodepoetry / fucntions.php
Created October 25, 2019 15:00
Facny title
add_action( 'get_header', 'dt_fancytitle_override', 10 );
function dt_fancytitle_override() {
$config = Presscore_Config::get_instance();
if( is_page(2) ) { // check for your condition
$config->set( 'fancy_header.title.mode', 'custom' );
$config->set( 'fancy_header.title', 'My new custom title' );
@thecodepoetry
thecodepoetry / fucntions.php
Created October 9, 2019 06:20
Autor box with link
function presscore_display_post_author() {
?>
<div class="author-info entry-author">
<?php
$avatar = presscore_get_avatar( get_the_author_meta( 'ID' ), 80 );
$authorlink = get_author_posts_url(get_the_author_meta('ID'));
if ( $avatar ) {
echo '<div class="author-avatar round-images"><a href="'.$authorlink.'">' . $avatar . '</a></div>';
} else {
@thecodepoetry
thecodepoetry / functions.php
Created October 2, 2019 12:51
Testimonial with links.
add_action( 'init', function() {
class My_Testimonial_Override extends DT_Shortcode_Testimonials_Masonry {
protected function do_shortcode( $atts, $content = '' ) {
// Loop query.
$post_type = $this->get_att( 'post_type' );
$config = presscore_config();
if ( 'posts' === $post_type ) {
$query = $this->get_posts_by_post_type( 'dt_testimonials', $this->get_att( 'posts' ) );
}else {