FalsAlarm
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: How to fix wordpress wp_get_archives() function problemsweet thanks bro, that resolved the issues I was having.. ??
Forum: Developing with WordPress
In reply to: How to fix wordpress wp_get_archives() function problemalso, in case you didn’t notice on my blog on the archives page, the links don’t actually work with the date included so it does matter.
Forum: Developing with WordPress
In reply to: How to fix wordpress wp_get_archives() function problemplease tell me how I can hook the ‘get_archives_link’ filter and strip out the date portion.
Forum: Developing with WordPress
In reply to: How to fix wordpress wp_get_archives() function problemAlso, I tried creating a date.php file and copying the contents of my archive.php file to it, but that doesn’t seem to help the link structure of the anchors at all. ??
Forum: Developing with WordPress
In reply to: How to fix wordpress wp_get_archives() function problemAlso, I resolved the issue of why not all of my posts were showing up on the homepage.
I created an archive.php file for my theme just now. Below is the contents of that file.
<?php /* Template Name: Archives */ get_header(); ?> <?php $args = array( 'posts_per_page' => -1, 'orderby' => 'date', 'order' => 'ASC', ); //$args = array($args); $posts_array = get_posts($args); echo '<div class="row">'; //echo "<p>Found, " . count($posts_array) . "</p>"; foreach($posts_array as $post) { echo '<div class="col-sm-3 border" style="text-align:center;">'; echo "<h3 class='headers'><a href='" . $post->post_name ."'>" . $post->post_title . "</h3>"; echo "<p>" . $post->post_content . "</p></a>"; echo "</div>"; } echo '</div>'; ?> <?php get_sidebar(); ?> <?php get_footer(); ?>
After creating this file, whenever I click on the month it takes me correctly to the new archive.php where it now shows up all 6 of my posts which is awesome.
However, I notice that the links differ from the links on the homepage. The links include the month and day before the post title for some odd reason.
Hopefully, you can help me fix this issue, please and thanks.
Forum: Developing with WordPress
In reply to: How to fix wordpress wp_get_archives() function problembelow is a copy of my index.php file.
<?php get_header(); ?> </div> <!-- A grey horizontal navbar that becomes vertical on small screens --> <?php //include the database file //include 'database.php'; //$query = "SELECT * FROM wp_mnqhposts WHERE post_type='post'"; //echo $query; //$result = mysqli_query($con, $query); //if (mysqli_num_rows($result) > 0) { // while($row = mysqli_fetch_assoc($result)) { // //echo "post_title: " . $row['post_title'] . "<br>"; // //echo "post_title: " . $row['post_title'] . "<br>"; // } // } else { // //echo "0 results"; // } //mysqli_close($con); //$fivesdrafts = $wpdb->get_results( // "SELECT * FROM $wpdb->posts WHERE id <= 60 && post_type='post' && post_title!='Auto Draft'" //); // //echo '<div class="row">'; //foreach ( $fivesdrafts as $fivesdraft ) //{ // echo '<div class="col-sm-3" style="text-align:center;">'; // //echo "<br>".print_r($fivesdraft); // echo '<h2><a href='.$fivesdraft->post_name.'>'.$fivesdraft->post_title.'</a></h2>'; // //echo "<br><a href='.$fivesdraft->post_title.'>".$fivesdraft->post_title."</a>"; // echo "<p>".$fivesdraft->post_content . "</p>"; // echo wpautop( $fivesdraft->post_content ); // echo '</div>'; //} //echo '</div>'; //?> <?php $args = array( 'posts_per_page' => -1, 'orderby' => 'date', 'order' => 'ASC', ); //$args = array($args); $posts_array = get_posts($args); echo '<div class="row">'; //echo "<p>Found, " . count($posts_array) . "</p>"; foreach($posts_array as $post) { echo '<div class="col-sm-3 border" style="text-align:center;">'; echo "<h3 class='headers'><a href='" . $post->post_name ."'>" . $post->post_title . "</h3>"; echo "<p>" . $post->post_content . "</p></a>"; echo "</div>"; } echo '</div>'; ?> <?php get_sidebar(); ?> <?php get_footer(); ?> </body> </html>
I couldn’t find a way to seperate the and the text from the content of the post so I did a little hack of wrapping it all up in an tag.
Furthermore, I did create my own custom theme but I did not specify a archive.php file at all. Am I supposed to do that?
Forum: Fixing WordPress
In reply to: get_posts() not returning all poststhe code is in my index.php
Also, removing the $args = line resolved the issue and using the defaults must have helped because it is working now.
thank you everyone for the help, much appreciated.
Forum: Developing with WordPress
In reply to: How to fix wordpress wp_get_archives() function problemI forgot to mention that my permalinks setting is currently set to post name but the urls on the generated page when click on the month is set to be 02/01/post name
which is a problem, how do i fix?