Skip to content

Instantly share code, notes, and snippets.

@AnnaCrumina
AnnaCrumina / Excerpt length with characters
Created December 28, 2015 09:38
Characters instead of words in Excerpt length option for Secondtouch
function content( $num, $no_more = false ) {
global $post;
$options = get_option( 'second-touch' );
if ( $options['read_more_style'] == '0' ) {
$read_more_link = '<a href="' . get_permalink( $post->ID ) . '" class="link-read-more"> </a>';
} else {
$read_more_link = '<a href="' . get_permalink( $post->ID ) . '"> ' . __( 'Read more', 'crum' ) . '</a>';
}
@AnnaCrumina
AnnaCrumina / gist:f120cf1176c968b014f4
Created December 18, 2015 08:29
custom logo on mobile devices for Embrace
add_action('init','crum_remove_standard_logo');
function crum_remove_standard_logo(){
remove_action( 'reactor_header_inside', 'reactor_do_title_logo', 1 );
}
function reactor_do_title_custom_logo() {
echo '<div class="logo large-2 medium-2 small-12 columns">';
reactor_do_custom_logo(false);
add_action( 'init', 'crum_remove_socicons' );
function crum_remove_socicons() {
remove_action( 'reactor_header_after', 'crumina_social_icons', 2 );
}
/**
* Phone number
* in header.php
<div class="contacts-widget">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p class="adr">
<span class="street-address">Company LTD Street nr 100, 4536534</span>,
<span class="locality"> Chicago</span>,
</p>
<p class="phone">(212) 555 55 00 or (212) 555 55 00</p>
<p class="mail">E-Mail: <a class="email" href="mailto:Somemail@gmail.com">Somemail@gmail.com</a></p>
<p class="twitter">Twitter: <a class="fn org url" href="somewebadress.com">somewebadress.com</a></p>
@AnnaCrumina
AnnaCrumina / gist:1b556f898825fd40fd7e
Created June 9, 2015 07:38
social icons open in a new tab
<script type="text/javascript">
jQuery('.soc-icons a').click(function() {
jQuery(this).attr('target', '_blank');
});
</script>
<div class="row service-box">
<div class="twelve columns">
<div class="service-icon">
<img src="http://www.wydajksiazke.com.pl/wp-content/uploads/tabl@2x-75x75.png" alt="Wspieramy">
</div>
@AnnaCrumina
AnnaCrumina / gist:71c837eab6e30538dd19
Created May 21, 2015 08:25
Smooth scroll for anchor links
<script>
jQuery('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') || location.hostname == this.hostname) {
var target = jQuery(this.hash);
target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
if (target.length) {
var top_offset = '100';
jQuery('html,body').animate({
scrollTop: target.offset().top - top_offset
@AnnaCrumina
AnnaCrumina / gist:222fb826e4cb91d9e5d0
Created May 18, 2015 07:36
Glider:align 3d level of menu with the top of the submenu
.menu-primary-navigation ul li {
position: static !important;
}
.menu-primary-navigation a {
position: relative !important;}
.menu-primary-navigation ul.dropdown li ul.dropdown {
top: 0;
}
/**
* Custom shortcode on all pages
* in header.php
*
* @since 1.0.0
*/
function shortcode_after_header ()
{
/**
* Stunning header
* in header.php
*
* @since 1.0.0
*/
function frontpage_st_header ()
{
if (is_page_template('page-templates/fullwidth-page.php') ):