IceFlame5
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Post posts from certain month on external sitei actually got it working! Thanks for your help. I found out the issue. its monthnum it needs to be an integer and we were giving it a string before. Thus = fail so this is what i did.
<?php list( $month, $year ) = explode( '-', basename( __FILE__, '.php' ) ); $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; if($month=="january"){ $month = "1"; }else if($month=="february"){ $month = "2"; }else if($month=="march"){ $month = "3"; }else if($month=="april"){ $month = "4"; }else if($month=="may"){ $month = "5"; }else if($month=="june"){ $month = "6"; }else if($month=="july"){ $month = "7"; }else if($month=="august"){ $month = "8"; }else if($month=="september"){ $month = "9"; }else if($month=="october"){ $month = "10"; }else if($month=="november"){ $month = "11"; }else if($month=="december"){ $month = "12"; } $args = array( 'posts_per_page' => 10, 'paged' => $paged, 'year' => $year, 'monthnum' => $month, ); $the_query = new WP_Query( $args ); while ( $the_query->have_posts() ) : $the_query->the_post(); echo "<h2>"; the_title(); echo "</h2>"; echo "<span style='font-size:11px;'>By <a href='/company/employees/cameronandrews.php'>"; the_author(); echo "</a> | Published "; the_date(); echo "</span><br /><br>"; the_content(); endwhile; ?>Forum: Fixing WordPress
In reply to: Post posts from certain month on external siteDoesnt seem to change the outcome.
Forum: Fixing WordPress
In reply to: Post posts from certain month on external siteYeah here you go:
<?php require('../blog/wp-blog-header.php'); require('../blog/wp-includes/general-template.php'); ?> <?php list( $month, $year ) = explode( '-', basename( __FILE__, '.php' ) ); $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $args = array( 'posts_per_page' => 10, 'paged' => $paged, 'date_query' => array( array( 'year' => (int) $year, 'month' => (int) $month, ), ), ); $posts = get_posts( $args ); foreach ($posts as $post) : setup_postdata( $post ); echo "<h2>"; the_title(); echo "</h2>"; echo "<span style='font-size:11px;'>By <a href='/company/employees/cameronandrews.php'>"; the_author(); echo "</a> | Published "; the_date(); echo "</span><br /><br>"; the_content(); endforeach; ?>Forum: Fixing WordPress
In reply to: Post posts from certain month on external siteUH OH. i figured out how to publish it so it was in say september, but it still pulls the post.
Forum: Fixing WordPress
In reply to: Post posts from certain month on external siteIs there a way i can make a “test” post for say a month from now or a month ago to make sure it doesnt pull that post. Because it seems to be working now but just in case i want to test. and i very much thank you for your help.
Forum: Fixing WordPress
In reply to: Post posts from certain month on external siteprints this “november2013”
http://cameronandrews.com/blog/archives/november-2013.php
and yes i did put the dash as you can tell by the link above.
Forum: Fixing WordPress
In reply to: Post posts from certain month on external siteNever mind the basic php worked. but the code to pull the month and such didnt. Ideas as to why?
Forum: Fixing WordPress
In reply to: Post posts from certain month on external siteDoesnt seem to show anything.
Forum: Fixing WordPress
In reply to: Post posts from certain month on external siteSo it would be this? Because this is not working. Sorry for the hassle.
http://cameronandrews.com/blog/archives/november-2013.php
<?php require('blog/wp-blog-header.php'); require('blog/wp-includes/general-template.php'); ?> <?php list( $year, $month ) = explode( '-', basename( __FILE__, '.php' ) ); $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $args = array( 'posts_per_page' => 10, 'paged' => $paged, 'date_query' => array( array( 'year' => (int) $year, 'month' => (int) $month, ), ), ); $posts = get_posts( $args ); foreach ($posts as $post) : setup_postdata( $post ); echo "<h2>"; the_title(); echo "</h2>"; echo "<span style='font-size:11px;'>By <a href='/company/employees/cameronandrews.php'>"; the_author(); echo "</a> | Published "; the_date(); echo "</span><br /><br>"; the_content(); endforeach; ?>Forum: Fixing WordPress
In reply to: Post posts from certain month on external siteDoesn’t seem to work. I am basically building an archive system manually.
You go to recent posts and and shows the most up to date posts at the moment that is November. But when it turns to December and i click the November archive i want it to display only posts from November. and then when i click the December archive it only shows posts from December.
I say manually because then all i have to do is change either a number or a word in the programming for each new paged archive.
SO at the moment i have:
blog/index.php <- Recent Posts (Contains a sidebar where the archives are)
blog/archives/november2013.php <- Only November Posts—
when December hits i will copy the code from november2013.php and make a new page called december2013.php and just change the number or word that gives it the month thus making it work for December 2013.