Konstabel
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Excerpt not workingI found the problem.
My search loop was empty. By adding a WP_Query search before I managed to get posts, and then their excerpts.
The empty query was due to the page address (I am making a custom page).
<?php $the_query = new WP_Query('define your own query'); if($the_query->have_posts()): while ($the_query->have_posts()): $the_query->the_post();?> <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2> <p><?php the_excerpt(); ?><p> endwhile; else: echo '<p>Nothing found</p>'; endif; ?>
Forum: Fixing WordPress
In reply to: Accessing background image CSSPerfect thanks.
Before I was not able to scroll the page if the content was too much.
For reference, the final code:
body { background-size:cover; background-image: url(../images/background.jpg); }
Forum: Fixing WordPress
In reply to: Post specific menu based on contentThanks GC,
90% of what I am looking for. I tried it on a test .html document and gives me what I want. But when in WP, nothing happens.
For the other 10%, how do I run this script on a specific post?
I added your script to my header.php file, and made the necessary changes to my index.php.
Below an exerpt of my index.php:
<nav> <ul class="h1list"></ul> </nav> <article class="content"><!-- /content --> <?php if(have_posts()): while (have_posts()): the_post();?> <article class="post"> <h1><a href="<?php the_permalink();?>"><?php the_title();?></a></h1> <?php the_content(); ?> </article> <?php endwhile; else: echo '<p>Geen joernaal inskrywings gevind nie</p>'; endif;?><!-- /the-loop --> </article><!-- /content -->
Forum: Fixing WordPress
In reply to: Accessing background image CSSHey Bob,
Thanks for your reply. Programming the CSS or finding the file is not my problem.
I tried amending the body tag through CSS to include a picture, but it did not work.
This is the code I did try:
body { width: 100%; height: 100%; background-image: url(../images/background.jpg); background-color: #EEE; }
Changing the colour though, does work.
If I activate
add_theme_support( 'custom-background' );
I can add an image through the admin panel, but it does not cover the full screen.Forum: Fixing WordPress
In reply to: Javascript breaks nav linksThanks for your help!!
Forum: Fixing WordPress
In reply to: Javascript breaks nav linksI found the problem.
'jQuery'
is case sensitive. I used'jquery'
.Why is the jQuery option better?
Forum: Fixing WordPress
In reply to: Javascript breaks nav linksHi Neo,
Thanks for your reply.
I got it working by removing the
e.preventDefault();
.I tried implementing your suggestion, but I must be doing something wrong.
This is what I did:
<script> jquery.noConflict() (function($){ $('#navigation a, #fixedheader a').on('click', function(e) { }); $(window).on('scroll',function() { var scrolltop = $(this).scrollTop(); if(scrolltop >= 65) { $('#fixedheader').fadeIn(500); } else if(scrolltop <= 60) { $('#fixedheader').fadeOut(50); } }); })(jquery); </script>
What am I not understanding?
Forum: Fixing WordPress
In reply to: Get and show latest post contentsFinally I got what I wanted:
<?php $args = array( 'numberposts' => '1' ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo '<h3><a href="' . get_permalink($recent["ID"]) . '">' . $recent["post_title"].'</a></h3>'; echo $recent["post_content"]; } ?>
Forum: Fixing WordPress
In reply to: Get and show latest post contentsMy very next search got me a solution to post content but not the correct contents.
I added the line
echo $post->post_content;
The complete code now reads:
<?php $args = array( 'numberposts' => '1' ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo '<a href="' . get_permalink($recent["ID"]) . '">' . $recent["post_title"].'</a>'; echo $post->post_content; } ?>
Would still like to hear your comments.