This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // get the the role object | |
| $role_object = get_role( 'editor' ); | |
| // add $cap capability to this role object | |
| $role_object->add_cap( 'edit_theme_options' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Translate a string in functions.php | |
| function translate_buy($translated) { | |
| $translated = str_ireplace('Place order', 'Buy it now!', $translated); | |
| return $translated; | |
| } | |
| add_filter('gettext', 'translate_buy'); | |
| add_filter('ngettext', 'translate_buy'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Line breaks work as long as you escape them; use %23 instead of # inside of the svg */ | |
| .image { | |
| position: absolute; | |
| width: 100%; | |
| height: 100%; | |
| background-image: url('data:image/svg+xml;utf-8, \ | |
| <svg width="300px" height="300px" viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg">\ | |
| <g stroke-width="4" stroke="%23eaeae1" fill="%23fff"> \ | |
| <polygon points="150 205 85.3436222 238.991869 97.6918916 166.995935 45.3837832 116.008131 117.671811 105.504065 150 40 182.328189 105.504065 254.616217 116.008131 202.308108 166.995935 214.656378 238.991869 "></polygon>\ | |
| </g>\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).ready(function($) { | |
| // Run fitVids if it's available | |
| if ( $.isFunction($.fn.fitVids) ) | |
| $(".entry-content").fitVids(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Get fields | |
| if ( function_exists( 'types_render_field' ) ){ | |
| $address = types_render_field("address", array("output"=>"html")); | |
| } | |
| // Echo fields | |
| if ($address) echo $address; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Retrieve a WYSIWYG Types plugin field | |
| // and suppress third-party filters | |
| // (useful when working with Jetpack Sharedaddy) | |
| $field = types_render_field("fieldname", array("output"=>"html", "suppress_filters"=>"true")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Append classes to color the lists | |
| $('.hentry ul').addClass('list-colored').children().wrapInner('<span class="li-inner">'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // ----------------------------------------------------------------------------- | |
| // Usage: place the function in functions.php | |
| // Then call it from within the loop in the theme index.php, single.php etc. | |
| // while ( have_posts() ) : the_post(); if (iseek_user_access() ): | |
| // ... secret content goes here | |
| // endif; | |
| // ----------------------------------------------------------------------------- | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //usage: place in functions.php | |
| // has a certain page in ID | |
| function is_tree($pid) { // $pid = The ID of the page we're looking for pages underneath | |
| global $post; // load details about this page | |
| if( is_page() && ( $post->post_parent == $pid || is_page( $pid ) || get_topmost_parent( $post->ID ) == $pid ) ) return true; | |
| else return false; // we're elsewhere | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // place in functions.php | |
| add_filter('gettext', 'lightseek_translate_text'); | |
| add_filter('ngettext', 'lightseek_translate_text'); | |
| function lightseek_translate_text($translated) { | |
| $translated = str_ireplace('Old String', 'New String', $translated); | |
| return $translated; | |
| } |