pg73
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Redirect old posts now '/blog' has been added to permalinkSorry, that should be 301 redirect.
Forum: Fixing WordPress
In reply to: Display Custom Field 'Name' OnlyProbably not the best way to do it, but I’ve got it working at least.
<?php $values = get_post_custom_values("preview-image"); if (isset($values[0])) { ?> <article <?php post_class("preview-image module-teaser") ?> id="post-<?php the_ID(); ?>" > <?php } else { ?> <article <?php post_class(" module-teaser") ?> id="post-<?php the_ID(); ?>" > <?php } ?>
Forum: Fixing WordPress
In reply to: Display Custom Field 'Name' Only<?php if(get_post_custom_values('preview-image')) : foreach(get_post_custom_values('preview-image') as $image) : ?> <img class="post-preview-image" src="<?php echo home_url( '/' ); ?>wp-content/uploads/preview-images/<?php echo $image; ?>" /> <?php endforeach; endif; ?>
Forum: Fixing WordPress
In reply to: Display Custom Field 'Name' OnlyThat sounds good, but how would I go about doing that Andrew?
Forum: Fixing WordPress
In reply to: How to Change Loop to Order Posts by ViewsThank you vtxyzzy, that worked like a charm! I’ve been searching everywhere to see how to do this and couldn’t get an answer and it turned out to be quite simple (if you know what you’re doing!). I really appreciate your help, thanks again.
Forum: Fixing WordPress
In reply to: Create Anchor Points in Category Titles of LoopExcellent! – works great, thank you ??
Forum: Fixing WordPress
In reply to: Create Anchor Points in Category Titles of LoopI just need code adding to the sidebar list (see code above) to create the text that appears in the yellow box when you hover over a link, it’s usually this in the HTML:
title="text-goes-here"
Is it possible to slip that into the code above so that it says: “Jump to ‘category name automatically added here’ “.
Thank you.
Forum: Fixing WordPress
In reply to: Create Anchor Points in Category Titles of LoopSorry, one last thing… is it possible to add some code to create hover text for the list, that would say ‘Jump to “Category name”‘ – thank you.
<?php $get_cats = get_terms( 'category' , array( 'exclude' => '4,7' , 'orderby' => 'name' , 'fields' => 'names' ) ); if( !empty( $get_cats ) ) { $anchors = array(); foreach( $get_cats as $key => $data ) $anchors[] = '<a href="#' . $data . '">' . $data . '</a>'; echo '<li>' . implode( ' </li><li>' , $anchors ) . '</li>'; } unset( $get_cats , $key , $data , $anchors ); // Unsets data no longer needed ?>
Forum: Fixing WordPress
In reply to: Create Anchor Points in Category Titles of LoopBrilliant, it’s all working as it should now, thank you for all your help – you’ve saved me so much time. I’ll leave you in peace for a while now ??
Forum: Fixing WordPress
In reply to: Create Anchor Points in Category Titles of LoopIf I target what you suggested it would add space between ALL the posts, I just need a space after the LAST post of each category.
Here is the html of a category title and the post, is it possible to target the a name
<a name="Photography">
of each category, except for the first category?<a name="Photography"></a><p class="topic-titles">Photography</p><div class="title-spacer"></div> <!-- ARTICLE TEXT --> <div class="articles-article-text"> <h2<a href="https://domain.com/another-test-title" rel="bookmark" title="Read the full article: Another Test Title">Another Test Title</a></h2> </div> <!-- ARTICLE META DATA --> <div class="articles-articlemetadata">
Forum: Fixing WordPress
In reply to: Create Anchor Points in Category Titles of LoopJust had a thought, could I target the anchor names to add the space before each category name but exclude the first category name.
https://wordpress.pastebin.com/XtbL1pRP
Thank you.
Forum: Fixing WordPress
In reply to: Create Anchor Points in Category Titles of LoopI need to add some space after the end of each category’s posts, but before the next category starts. The only way I can do this with CSS adds space before the category title, which would be fine except I really don’t want the first category to have this space as it’s going to complicate things down the road.
Is it possible to add to the loop the following for example (if this is the best way): <div class=”title-spacer”></div> that will appear only at the end of each Category’s group of posts, so that I can style that with CSS. Sorry to be a pain, hope you can help, thanks.
Forum: Fixing WordPress
In reply to: Buttons to Change Loops on a Single PageGreat, will try it later and let you know how I get on with it, thanks! I’m still working on getting those anchors styled just how I want them – actually (if it’s not taking the p), can I ask for one more thing – I will write it in the other post. THANK YOU.
Forum: Fixing WordPress
In reply to: Create Anchor Points in Category Titles of LoopHello, thanks for the code it worked great – well, I say great, after I styled it all up it was working great in Safari but not in other browsers I tested. I see now it was how I did my styling so I just need to play around with that.
I really do appreciate the help you gave, btw I would be interested in your thoughts on a post I made a few days ago, Buttons to Change Loops on a Single Page. I couldn’t find any information on it so had to go the other route of linking to a second page, which works fine, but really curious to know if what I originally wanted is possible.
Thank you.
Forum: Fixing WordPress
In reply to: Create Anchor Points in Category Titles of LoopThat’s great, I’m off to bed now so will check back in the morning, thank you for your help, it’s really good of you, I’m looking forward to testing it out!