Created
March 22, 2018 11:37
-
-
Save NickDeckerDevs/73c22214cd09513a7fdb650fa33f31fd to your computer and use it in GitHub Desktop.
some tierpoint stuff
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 | |
| function my_theme_enqueue_styles() { | |
| $parent_style = 'parent_style'; | |
| wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); | |
| wp_enqueue_style( 'child-style', | |
| get_stylesheet_directory_uri() . '/style.css', | |
| array( $parent_style ), | |
| wp_get_theme()->get('Version') | |
| ); | |
| } | |
| add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); | |
| function stop_the_show() { | |
| echo '<h1>STOP NICK</h1>'; | |
| die('asdf'); | |
| } | |
| // add_action( 'the_post', 'stop_the_show' ); | |
| function wpb_postsbycategory($blog_title) { | |
| // the query | |
| // die($blog_title); | |
| $cats = $blog_title == 'News' ? 230 : array( 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1); | |
| // die($cats); | |
| $the_query = new WP_Query( array( 'cat' => $cats, 'posts_per_page' => 10 ) ); | |
| $string = '<div id="sidebar"><div id="rpwe_widget-4" class="et_pb_widget rpwe_widget recent-posts-extended">'; | |
| $string .= '<h4 class="widgettitle">' . $blog_title . '</h4><div class="rpwe-block">'; | |
| // The Loop | |
| if ( $the_query->have_posts() ) { | |
| $string .= '<ul class="rpwe-ul">'; | |
| while ( $the_query->have_posts() ) { | |
| $the_query->the_post(); | |
| $string .= '<li class="rpwe-li rpwe-clearfix">'; | |
| $string .= '<h3 class="rpwe-title"><a href="' . get_the_permalink() .'" title="' . get_the_title() . '" rel="bookmark">' . get_the_title() .'</a></h3></li>'; | |
| } | |
| } else { | |
| // no posts found | |
| } | |
| $string .= '</ul></div></div></div>'; | |
| echo $string; | |
| return $string; | |
| /* Restore original Post Data */ | |
| wp_reset_postdata(); | |
| } | |
| // Add a shortcode | |
| add_shortcode('categoryposts', 'wpb_postsbycategory'); | |
| // Enable shortcodes in text widgets | |
| add_filter('widget_text', 'do_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment