Next/Previous Post Link Plus (Ambrosite) Plug In making post disappear
-
Admin
Quote:There are a variety of options of how to complete this:– Edit loop.php, Advantage – simple, Disadvantage – overwritten when Graphen is updated
– Copy loop.php, then edit – Advantage keep changes when upgrading, Disadvantage never get the benefits of new features in upgrades
– Use Action Hooks, Advantage can upgrade and get benefits, easy to move to another hook, drawbacks more complex to implement.
Gotta love how concise you put it 🙂
Ok, I don’t mean to be a pain but I’m stuck.
I removed the loop.php and single.php from the child theme folder.
So it’s using just the normal in the normal folder loop and single.php files with no modifications.
Then I added to the child theme functions.php the code you have above so with what I already had and what I added my child functions.php looks like this:
<?php
function graphene_slider_post_types(){
return array(‘post’, ‘page’);
}
add_filter( ‘graphene_slider_post_type’, ‘graphene_slider_post_types’ );
?>
<?php
// attaches the function my_post_nav to the hook graphene_post_nav
add_action (‘graphene_post_nav’, ‘my_post_nav’);
// our function
function my_post_nav(){
// this will allow us to use other hooks but still only show on single posts
if ( is_single() && ! is_page() ) : ?>
<div id=”my-post-nav”> <!– div to contain your links –>
<?php previous_post_link_plus( array(
‘order_by’ => ‘menu_order’,
‘loop’ => true,
‘max_length’ => 0,
‘tooltip’ => ‘Previous page’,
‘in_same_cat’ => true,
‘ex_cats’ => ’12’
) );?> |
<?php next_post_link_plus( array(
‘order_by’ => ‘menu_order’,
‘loop’ => true,
‘max_length’ => 0,
‘tooltip’ => ‘Next page’,
‘in_same_cat’ => true,
‘ex_cats’ => ’12’
) );?>
</div>
<?php endif; ?>
<?php } ?>
I made no changes to the styles and checked the live page and no links were there (as they were when I had it set up the other way)
Then I added to the child theme style.css file:
I added
}
#previous-new,
#previous-new a,
#previous-new a:visited,
#next-post-new,
#next-post-new a,
#next-post-new a:visited {
color: #929292;
font: 12px tahoma;
text-decoration: none;
}
#previous-new {
float: left;
margin-left: 8px;
}
#next-post-new {
float: right;
margin-right: 8px;
text-align: right;
}
#previous, #next-post {display: none;}
I refreshed the page and the links were there but:
1. They are in the wrong order, as in doing traditional post linkage order like newer to oldest, which is not what I want. When I had it set up before it was reading “menu order” from the way I arranged them in postMash. So the order isn’t going right now.
2. Then when I clicked on my home page link I got a page of errors
Warning: Cannot modify header information – headers already sent by (output started at /home/juicytrv/public_html/wp-content/themes/graphene-child/functions.php:38) in /home/juicytrv/public_html/wp-includes/pluggable.php on line 934
and
Warning: Cannot modify header information – headers already sent by (output started at /home/juicytrv/public_html/wp-content/themes/graphene-child/functions.php:38) in /home/juicytrv/public_html/wp-content/plugins/smarter-navigation/main.php on line 86
Warning: Cannot modify header information – headers already sent by (output started at /home/juicytrv/public_html/wp-content/themes/graphene-child/functions.php:38) in /home/juicytrv/public_html/wp-content/plugins/smarter-navigation/main.php on line 86
Warning: Cannot modify header information – headers already sent by (output started at /home/juicytrv/public_html/wp-content/themes/graphene-child/functions.php:38) in /home/juicytrv/public_html/wp-content/plugins/smarter-navigation/main.php on line 86
So clearly I missed a step in what you suggested I do…sorry…can you help me troubleshoot please?
Thanks so much.
If my child themes function file is this:
<?php
function graphene_slider_post_types(){
return array(‘post’, ‘page’);
}
add_filter( ‘graphene_slider_post_type’, ‘graphene_slider_post_types’ );
?>
<?php
// attaches the function my_post_nav to the hook graphene_post_nav
add_action (‘graphene_post_nav’, ‘my_post_nav’);// our function
function my_post_nav(){// this will allow us to use other hooks but still only show on single posts
if ( is_single() && ! is_page() ) : ?>
<div id=”my-post-nav”> <!– div to contain your links –>
<?php previous_post_link_plus( array(
‘order_by’ => ‘menu_order’,
‘loop’ => true,
‘max_length’ => 0,
‘tooltip’ => ‘Previous page’,
‘in_same_cat’ => true,
‘ex_cats’ => ’12’
) );?> |
<?php next_post_link_plus( array(
‘order_by’ => ‘menu_order’,
‘loop’ => true,
‘max_length’ => 0,
‘tooltip’ => ‘Next page’,
‘in_same_cat’ => true,
‘ex_cats’ => ’12’
) );?>
</div>
<?php endif; ?>
<?php } ?>
[code]I don’t get where it’s telling it to use the Ambrosite plugin. Like when I changed the loop file I changed
[code]
<p id=”previous”><?php previous_post_link(); ?></p>
<p id=”next-post”><?php next_post_link(); ?></p>
[code]to
[code]
<p id=”previous”><?php previous_post_link_plus(); ?></p>
<p id=”next-post”><?php next_post_link_plus(); ?></p>
[code]And it seems like I’m telling it to use that plug in? But in what we pasted into the functions.php file it doesn’t seem like that connection is being made?
[code]
<?php
function graphene_slider_post_types(){
return array(‘post’, ‘page’);
}
add_filter( ‘graphene_slider_post_type’, ‘graphene_slider_post_types’ );
?>
<?php
// attaches the function my_post_nav to the hook graphene_post_nav
add_action (‘graphene_post_nav’, ‘my_post_nav’);
// our function
function my_post_nav(){
// this will allow us to use other hooks but still only show on single posts
if ( is_single() && ! is_page() ) : ?>
<div id=”my-post-nav”> <!– div to contain your links –>
<?php previous_post_link_plus( array(
‘order_by’ => ‘menu_order’,
‘loop’ => true,
‘max_length’ => 0,
‘tooltip’ => ‘Previous page’,
‘in_same_cat’ => true,
‘ex_cats’ => ’12’
) );?> |
<?php next_post_link_plus( array(
‘order_by’ => ‘menu_order’,
‘loop’ => true,
‘max_length’ => 0,
‘tooltip’ => ‘Next page’,
‘in_same_cat’ => true,
‘ex_cats’ => ’12’
) );?>
</div>
<?php endif; ?>
<?php } ?>
I don’t get where it’s telling it to use the Ambrosite plugin. Like when I changed the loop file I changed
[code]
<p id=”previous”><?php previous_post_link(); ?></p>
<p id=”next-post”><?php next_post_link(); ?></p>
[code]to
[code]
<p id=”previous”><?php previous_post_link_plus(); ?></p>
<p id=”next-post”><?php next_post_link_plus(); ?></p>
[code]And it seems like I’m telling it to use that plug in? But in what we pasted into the functions.php file it doesn’t seem like that connection is being made?
[code]
I don’t get where it’s telling it to use the Ambrosite plugin. Like when I changed the loop file I changed
<p id=”previous”><?php previous_post_link(); ?></p>
<p id=”next-post”><?php next_post_link(); ?></p>
[code]to
[code]
<p id=”previous”><?php previous_post_link_plus(); ?></p>
<p id=”next-post”><?php next_post_link_plus(); ?></p>
[code]And it seems like I’m telling it to use that plug in? But in what we pasted into the functions.php file it doesn’t seem like that connection is being made?
[code]
<p id=”previous”><?php previous_post_link(); ?></p>
<p id=”next-post”><?php next_post_link(); ?></p>
to
[code]
<p id=”previous”><?php previous_post_link_plus(); ?></p>
<p id=”next-post”><?php next_post_link_plus(); ?></p>
[code]And it seems like I’m telling it to use that plug in? But in what we pasted into the functions.php file it doesn’t seem like that connection is being made?
[code]
to
<p id=”previous”><?php previous_post_link_plus(); ?></p>
<p id=”next-post”><?php next_post_link_plus(); ?></p>
[code]And it seems like I’m telling it to use that plug in? But in what we pasted into the functions.php file it doesn’t seem like that connection is being made?
[code]
<p id=”previous”><?php previous_post_link_plus(); ?></p>
<p id=”next-post”><?php next_post_link_plus(); ?></p>
And it seems like I’m telling it to use that plug in? But in what we pasted into the functions.php file it doesn’t seem like that connection is being made?
[code]
And it seems like I’m telling it to use that plug in? But in what we pasted into the functions.php file it doesn’t seem like that connection is being made?
I just realized that one set of those errors was smarter navigation conflicting which I’d installed but hadn’t figured out how to use yet. I deactivated that and the errors about that went away.
But, if you go to my home page the only thing there now is:
Warning: Cannot modify header information – headers already sent by (output started at /home/juicytrv/public_html/wp-content/themes/graphene-child/functions.php:38) in /home/juicytrv/public_html/wp-includes/pluggable.php on line 934
I don’t know what that’s about? The home page doesn’t load.
But once I disabled the smarter navigation plugin, my links are working off menu order perfectly on
http://juicytravels.com/the-ten-best-first-class-airline-experiences-now-2/
So now I’m down to two issues:
1. What is messing up the home page from loading? Maybe another conflict with something else?
2. Is there a way to get the links in the body of the post, not at the bottom but in the top right under the hr under the title, and aligned right?
3. If I wanted to include image arrows for the left and the right arrows, instead of the << and >>, can you help me with the css for that? I assume that’s a css thing or does it need to be somewhere else?
Thanks again…sorry not to be getting this figured out more smoothly!
2.
Now I have them at the bottom using your suggestion of
graphene_after_post_content instead of graphene_post_nav
see here
http://juicytravels.com/the-ten-best-first-class-airline-experiences-now/
Two questions:
1. Can I have them at both the top and the bottom? I tried adding ‘graphene_after_post_content’, before graphene_post_nav but then the links didn’t show up in either place.
2. If I keep them at the bottom like they are now, how would I give them more space from the content above it? I tried changing the style.css to add margin-top:20px and tried it with padding instead of margin but it didn’t have any effect, like this:
}
#previous-new,
#previous-new a,
#previous-new a:visited,
#next-post-new,
#next-post-new a,
#next-post-new a:visited {
color: #929292;
font: 12px tahoma;
text-decoration: none;
padding-top:20px;
}
#previous-new {
float: left;
margin-left: 8px;
padding-top:20px;
}
#next-post-new {
float: right;
margin-right: 8px;
text-align: right;
padding-top:20px;
}
#previous, #next-post {display: none;}Can I get them a little further down?
And, to make it one twist harder, if I keep them at the bottom, could I have a line break between the previous and next so they are on different lines?
I’m glad its working! Using what we have put in functions.php they are now in a div with id of my-post-nav so the css is not working. Try:
#my-post-nav {
clear: both;
border-top: 1px solid #E3E3E3;
padding-top: 10px;
}
.entry-footer {
display: none
}That should get them more or less where you want them.
If you want them at the top as well you need to add another line to functions.php
add_action('graphene_before_content', 'my_post_nav');
Since this will put two of these on the page you should change id to class for the div.
Thank you, yes yes yes!
http://juicytravels.com/the-ten-best-first-class-airline-experiences-now/
I think in both places is probably overkill, but just to try it out can you clarify
“Since this will put two of these on the page you should change id to class for the div. “
Not sure what to do with that.
Also, if I want to change the << >> to actual images, say they are previous.png and next.png, can you show me the css to use for that? I assume it would be in the css?
Thank you SO much for sticking with this with me…I can’t tell you how much I appreciate getting it dialed in!
- You must be logged in to reply to this topic.