Skip to content

Instantly share code, notes, and snippets.

@yozzi
yozzi / font-size.html
Created September 1, 2015 13:02
Increase and decrease font size with jQuery
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
<style type="text/css">
#content{
font-family: 'Lato', sans-serif;
text-align:justify;
font-size:14px;
}
</style>
@yozzi
yozzi / functions.php
Created September 9, 2015 19:26
Ajouter une class css a wp_get_attachment_link() pour empêcher qu'une transition animsition apparaisse à l'ouvertue de magnific popup
//Ajouter une class css a wp_get_attachment_link() pour empêcher qu'une transition animsition apparaisse à l'ouvertue de magnific popup
function startup_reloaded_modify_attachment_link( $markup, $id, $size, $permalink ) {
if (of_get_option( 'page-transition' )){
global $post;
if ( ! $permalink ) {
$markup = str_replace( '<a href', '<a class="no-animsition" href', $markup );
}
return $markup;
}
}
@yozzi
yozzi / scripts.js
Created September 9, 2015 19:59
Animate Bootstrap Carousel height change
//Animate carousel height change
//Désactivé, ça déconne dans le modal : le premier slide a une hauteur de 0px
function bsCarouselAnimHeight()
{
$('.carousel').carousel({
interval: 5000
}).on('slide.bs.carousel', function (e)
{
var nextH = $(e.relatedTarget).height();
$(this).find('.active.item').parent().animate({ height: nextH }, 500);
@yozzi
yozzi / script.js
Created September 9, 2015 20:02
animte.css for StartUp try-outs
//animate.css
jQuery(document).ready(function() {
jQuery('.st_bounceInLeft').addClass("bt_hidden").viewportChecker({
classToAdd: 'bt_visible animated bounceInLeft',
offset: 0,
repeat: true,
callbackFunction: function(elem, action){},
scrollHorizontal: false
@yozzi
yozzi / snippet.php
Created September 15, 2015 19:33
Adding static menu items to wp_nav_menu()
<?php
function my_nav_wrap() {
// default value of 'items_wrap' is <ul id="%1$s" class="%2$s">%3$s</ul>'
// open the <ul>, set 'menu_class' and 'menu_id' values
$wrap = '<ul id="%1$s" class="%2$s">';
// get nav items as configured in /wp-admin/
$wrap .= '%3$s';
@yozzi
yozzi / snippet.php
Last active September 15, 2015 23:02
Check if a menu is empty
<?php if ( has_nav_menu( 'navbar-primary' ) ) {
} ?>
@yozzi
yozzi / snippet.php
Created September 16, 2015 18:36
Non-collapsing navbar section
CSS
/* icon */ .custom-navbar .fa {font-size:25px}
@media (max-width:767px) {
.custom-navbar .navbar-right {
float: right;
padding-right: 15px;
}
.custom-navbar .nav.navbar-nav.navbar-right li {
@yozzi
yozzi / wp-config.php
Created November 6, 2015 21:02
Rename WordPress wp-content folder
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
/** Just before that, paste this: */
/** Rename the wp-content folder to assets and direct WP to it */
define ('WP_CONTENT_FOLDERNAME', 'assets');
define ('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME);
define ('WP_CONTENT_URL', 'http://yourdomain.com/'.WP_CONTENT_FOLDERNAME);
@yozzi
yozzi / function.php
Created November 16, 2015 01:51
Rename admin menu with js
// renommer Timeline Express en Timeline dans le menu
function startup_reloaded_timeline_js() {
if ( is_plugin_active('timeline-express/timeline-express.php')) { ?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#menu-posts-te_announcements .wp-menu-name").html("Timeline");
});
</script>
<?php }
}
@yozzi
yozzi / functions.php
Created November 16, 2015 01:52
Function to change a plugin icon
//Modify Timeline CPT
function wpse_65075_modify_timeline_menu_icon( $post_type, $args ) {
// Make sure we're only editing the post type we want
if ( 'te_announcements' != $post_type )
return;
// //Get labels and update them
// $labels = get_post_type_labels( get_post_type_object( $post_type ) );
// $labels->name = 'Some things';
// $labels->singular_name= 'Some thing';