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 | |
| if (($arr_posts->current_post +1) != ($arr_posts->post_count)) { | |
| echo 'If not the last do something'; | |
| } | |
| if (($arr_posts->current_post +1) == ($arr_posts->post_count)) { | |
| echo 'If last do something else'; | |
| } | |
| ?> |
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
| function pjl_single_tax_term_template( $single_template ) { | |
| global $post; | |
| //has_term( $term, $taxonomy, $post ); | |
| if ( has_term( '', 'news' ) ) { | |
| $single_template = dirname( __FILE__ ) . '/news.php'; | |
| } | |
| if ( has_term( '', 'article' ) ) { |
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
| function wpex_get_excerpt( $args = array() ) { | |
| // Defaults | |
| $defaults = array( | |
| 'post' => '', | |
| 'length' => 40, | |
| 'readmore' => false, | |
| 'readmore_text' => esc_html__( 'read more', 'text-domain' ), | |
| 'readmore_after' => '', | |
| 'custom_excerpts' => 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
| <?php | |
| /** | |
| * Template Name: Custom Page Category | |
| */ | |
| get_header(); ?> | |
| <div id="primary" class="content-area"> | |
| <main id="main" class="site-main" role="main"> | |
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
| //Gömmer texteditor i specificerad template | |
| function hide_editor() { | |
| $template_file = basename( get_page_template() ); | |
| if($template_file == 'skh-projektmall.php'){ // template | |
| remove_post_type_support('page', 'editor'); | |
| } | |
| } | |
| add_action( 'admin_head', 'hide_editor' ); |
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
| /** | |
| * Skydda e-postadresser | |
| * echo do_shortcode('[email mailto="epost@adress.se" link_txt="Maila mig"]') | |
| */ | |
| function pjl_secure_email_shortcode( $atts ) { | |
| extract( shortcode_atts( array( | |
| "mailto" => '', | |
| "link_txt" => '' | |
| ), $atts ) ); |
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
| function pjl_skh_feed($qv) { | |
| if (isset($qv['feed']) && !isset($qv['post_type'])) | |
| $qv['post_type'] = array('post', 'cpt_nr1', 'cpt_nr2'); | |
| return $qv; | |
| } | |
| add_filter('request', 'pjl_skh_feed'); |
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 | |
| $plugin_data = get_plugin_data( __FILE__ ); | |
| $plugin_version = $plugin_data['Version']; | |
| $plugin_author = $plugin_data['Author']; | |
| $plugin_author_uri = $plugin_data['AuthorURI']; | |
| ?> | |
| <hr /> | |
| <p>Version <?php echo $plugin_version; ?> | Plugin created by: <a href="<?php echo $plugin_author_uri; ?>" target="_blank"><?php echo $plugin_author; ?></a>.</p> |
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
| function time_open_quicktags() { | |
| if ( wp_script_is( 'quicktags' ) ) { | |
| ?> | |
| <script type="text/javascript"> | |
| QTags.addButton( 'pjl_tobb', 'Shortcode', '[time-open]', '', 'b', 'Shortcode', 202 ); | |
| </script> | |
| <?php | |
| } |
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
| function list_all_shortcodes() { | |
| global $shortcode_tags; | |
| $shortcodes = $shortcode_tags; | |
| ksort( $shortcodes ); | |
| $output = '<p>Available shortcodes:</p><ul>'; | |
| foreach( $shortcodes as $code => $function ) { $output .= '<li>' . $code . '</li>'; } |