Last active
August 7, 2018 13:50
-
-
Save danielpataki/d2a4aa5bedec00b5e8b3 to your computer and use it in GitHub Desktop.
WordPress Coding For Beginners
This file contains 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
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
This file contains 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
<article id="post-344" class="post-344 post type-post status-publish format-standard has-post-thumbnail sticky hentry category-photos tag-example tag-tag"> |
This file contains 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
/* | |
Theme Name: Twenty Fourteen Child | |
Theme URI: http://mytheme.com | |
Description: My Child Theme | |
Author: Daniel Pataki | |
Author URI: http://danielpataki.com | |
Template: twentyfourteen | |
Version: 1.0.0 | |
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready | |
Text Domain: my-child-theme | |
*/ | |
/* =Theme customization starts here | |
-------------------------------------------------------------- */ |
This file contains 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
add_filter( 'the_content', 'my_content_filter' ); | |
function my_content_filter( $content ) { | |
$content .= ' (checked by Daniel Pataki)'; | |
} |
This file contains 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( $coming_soon->have_posts() ) ?> | |
<ul> | |
<?php while( $coming_soon->have_posts() ) : $coming_soon->the_post() ?> | |
<li <?php post_class() ?>> | |
<a href='<?php the_permalink() ?>'><?php the_title() ?></a> | |
</li> | |
<?php endwhile; ?> | |
</ul> | |
<?php endif ?> |
This file contains 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( have_posts() ) ?> | |
<?php while( have_posts() ) : the_post() ?> | |
<div <?php post_class() ?>> | |
<h2><?php the_title() ?></h2> | |
<div class='content'> | |
<?php the_content() ?> | |
</div> | |
</div> | |
<?php endwhile; ?> | |
<?php else: ?> | |
Oh no, there are no posts here | |
<?php endif ?> |
This file contains 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
add_action( 'wp_enqueue_scripts', 'my_parent_styles' ); | |
function my_parent_styles() { | |
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); | |
} |
This file contains 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( date( 'G' ) > 18 ) : ?> | |
<h2>Good Night!</h2> | |
<?php else : ?> | |
<h2>Good Day </h2> | |
<?php endif ?> |
This file contains 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
if ( is_single() ) : | |
the_title( '<h1 class="entry-title">', '</h1>' ); | |
else : | |
the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); | |
endif; |
This file contains 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 | |
$args = array( | |
'post_type' => 'post', | |
'post_status' => 'future', | |
'category_name' => 'app_reviews', | |
'posts_per_page' => 3 | |
); | |
$coming_soon = new WP_Query( $args ); | |
?> |
This file contains 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
<h1 class="entry-title">THe title of my article</h1> |
This file contains 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
the_title( '<h1 class="entry-title">', '</h1>' ); |
This file contains 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
add_action( 'wp_footer', 'my_tracking_code' ); | |
function my_tracking_code() { | |
?> | |
// Paste Google Analytics code here | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment