dikkiedutton
MemberForum Replies Created
-
So i’ve found a solution that searches only pages, again – isn’t ideal. But if anyone knows of getting the pages first then posts last – I’d settle for that!
Add this to functions.php:
<?php
function mySearchFilter($query) {
$post_type = 'page';
if($query->is_main_query()){
if ($query->is_search) {
$query->set('post_type', $post_type);
}
}
};
add_action('pre_get_posts','mySearchFilter');
?>OK, so now I have it looking reasonable again… the search is working better and pulling out content on the pages – however it seems to be still putting the posts at the top of the results – when, in this instance, the page content is more important. Is there a way of prioritising the page content?
Cheers
Dikkie
And that’s the issue – it’s pulling results from the posts. I want the search results to pull everything the search string results from the posts AND the pages. For instance, if you search for ‘health’ i know that’s on a few of the PAGES in the content. However, it’s pulling out the four posts on the site plus one page. I’m using this as a website as opposed to a blog so the page content is perhaps more important than the posts.
Got it sorted with a plugin called Archive. Seems to do what I’m asking.
So if I wanted to create a page as a child page to ‘News’ that was specifically for holding an archive, how would I go about that?
Cheers
Thanks Prasanna, however this has led me to another question… archives…?
How do I set that up? Do I have to create another page?
Cheers
Dikkie
For those of you who are (not) interested. Here’s how I’ve done it:
Add this to the CSS:
dl.image_map {
display: block;
width: 960px;
height: 198px;
position: relative;
padding: 0px;
}
a.LINK0 {
left: 549px;
top: 135px;
background: transparent;
}
a.LINK0 {
display: block;
width: 250px;
height: 0;
padding-top: 13px;
overflow: hidden;
position: absolute;
}
a.LINK0:hover {
background: transparent;
border: 1px dashed black;
color: black;
}Then add this to a ‘graphene_header’ action hook in widgets:
<dl class="image_map">
<dd><a class="LINK0" title="Email" href="mailto:email@email.com"></a></dd>
</dl>Again, probably a better way to do it but this works for now!
Cheers
Dikkie
Viewing 10 posts - 1 through 10 (of 17 total)
- 1
- 2