Adhesive plugin not working
-
Hi,
Site: https://www.os42.com
I have added the Adhesive plugin [from https://www.asymptomatic.net] to my site. It has been activated and it shows a ‘sticky’ checkbox but it doesn’t appear to be working as it should. I have tried to make one particular post a sticky but it just isn’t happening.
Running on 1.2 Mingus.
Any one else had this problem or know what I may be doing wrong?
Thanks for any advice suggested ??
-
for me everything works fine, except on the archive pages, where i get
window.document.getElementById(a€?post-2a€2).parentNode.className += a€? adhesive_posta€?; welcome finally to eyetaga€?s weblog project [...]
inside the sticky post. anyone knows about this problem or how to get around this? see also https://blog.eyetag.deSomeonce contacted the author regarding a different plugin that he had created. The resulting reply leads one to believe that he or she may have no further interest in plugin development for WordPress. I may be wrong, but that’s the way it looks.
I was puzzled when Adhesive (2.1 beta on WP 1.5.1.2) worked so well at my website, but failed to give us a Sticky box on a website I set up for a good friend.
Here’s what I found…
My friend’s hosting service runs php as cgi… and in the adhesive_admin_footer() function there’s a call to
$_SERVER['SCRIPT_NAME']
which is fine on my site with php but not on hers with php-cgi. On her site you have to use$_SERVER['SCRIPT_URL']
, and that won’t work on my site.So I changed it to test both and it seems to work on both.
I changed line 159 to:
if((preg_match('|post.php|i', $_SERVER['SCRIPT_URL'])||preg_match('|post.php|i', $_SERVER['SCRIPT_NAME'])) && $_REQUEST['action'] == 'edit')
I hope this helps anyone else with the problem. It’s the old php as cgi catch!
eyetag, I was puzzled with the
window.document.get...
problem on archive pages, too, and the fix I used is this:On about line 105, you’ll find:
add_filter('the_content', 'adhesive_the_content', 15);
Comment that out with a couple of slashes, and I think you’ll get what you want:
// add_filter('the_content', 'adhesive_the_content', 15);
I suspect this is to format sticky content different than normal content, but since I don’t care about that, I just turned off that part of the plugin.
thanks, rich… this one worked for me also. but did you see that it?′s not keeping formatings in other pages than index? any idea how to get a sticky post, that looks the same on every page? i wouldn?′t mind also if it would be marked as ‘sticky’…
Rich, that worked for me also. Thank you.
eyetag et-al.,
Another (better?) way to fix this and retain formatting, is to make Archives and Categories get formatted the same way as the index page. Normally, Archives and Categories have most of the formatting stripped out (which is just confusing in my opinion).
Go to archive.php (not archives.php) in your Theme, find where it says “the_excerpt” and change it to “the_content”. This makes any formatting / images you have in the posts appear the same as they do on the index page.
The knock-on effect of this is that Adhesive’s filter then works as expected, which eliminates the window.document… message.
Check out the tutorial I wrote at MaxPower.ca: wordpress sticky.
I think it might be applicable. Something like this will be in the codex soon too.
Note that the Adhesive plugin assumes certain things about the assigment of document element id’s. These are defined in the Theme files, not in WordPress itself, and they may or may not match Adhesive’s assumptions for display of index, search, archive etc.
For example, for the Kubrick Theme, I did the following:
1. Change.parentNode.className
to just.className
in adhesive.php itself.2. In the Theme files archive.php and search.php, move the id from the <h3> tag to the <div> tag, so it becomes:
<div class="post" id="post-<?php the_ID(); ?>">
(Arguably, it might be better to move the id from the <div> tag to the <h2> or <h3> in index.php, page.php and single.php. Then adhesive.php can remain unchanged.)
I should probably have mentioned that the above changes are only needed if you want to format your “sticky” posts differently to regular posts (I made mine look like Post-it notes with a push-pin).
If you do want a distinct appearance, then you need to make some changes (to the Kubrick theme at least) like those above, or else you may get different formatting depending on whether you are viewing the main page, Search, Archives&Categories, etc.
This has never worked for me and its the one plugin i have wanted for ages !..
fortunately this post
The sticky box was not showing up for me either I am running 1.5.1.2 and here is what I did to fix it. Kind of simple, but in the admin panel under options->writing-> then the first question “when starting a post show:” I had it set to advanced controls. I changed it back to simple controls, then deactivated the plugin, then reactivated it. Then I went and wrote my post and clicked on the advanced controls tab and what do you know, there is the sticky box.
Hope this helps someone.
-Benfixed it ??
Thanks all especially bencostello ??
I am running 1.5.1.2 and am not able to make it work at all. I see no checkbox, nothing. I’m using Safari on a MacOSX but I tried in Firefox and had the same result. Any ideas?
I tried the above suggestion and it didn’t work for me.
@eyetag (or whomever has had problems with the sticky code showing on achived pages)
<?php the_excerpt(); ?> strips out html code, in this case it is stripping out the <script></script> tags found on line 171 of adhesive.php.
My quick solution to this was to change <?php the_excerpt(); ?> to <?php the_content(); ?> I dont use excerpts anyways.
Just FYI.
Rich H. is right. I did what he said to do by replacing line 159 with the code below now the sticky shows up. I’m using wordpress 1.5.2 Thanks Rich for the tip!
if((preg_match(‘|post.php|i’, $_SERVER[‘SCRIPT_URL’])||preg_match(‘|post.php|i’, $_SERVER[‘SCRIPT_NAME’])) && $_REQUEST[‘action’] == ‘edit’)
@eyetag and others:
I played around a bit with the fixing of the window.document.get issue and tried to find a better way then to disable excerpts, which are valuable in an archive. So I build a simple if-else query that determines if a post is sticky or not. If it is sticky, it will display the whole post, if not, it will keep excerpts. The code is as follows:
Because you also have to disable the display of “Read more” for sticky posts, you have to replace not just <?php the_excerpt(); ?> in your archive.php but the following line too. In my case (neptun theme) it looks like this:
<?php the_excerpt(); ?>
<p class="more"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permalink">Read ‘<?php the_title(); ?>’</a></p>So replace these two line with the following (and change the text if your wp is not in english):
<?php if($post->is_sticky)
{
echo the_content();
} else {
echo the_excerpt();
}
?>
<?php if($post->is_sticky) {} else { echo "<p class="more"><a href=""; the_permalink(); echo "" rel="bookmark" title="Permalink">Read ‘"; the_title(); echo "’</a>
";
}
?>This should enable your achive to display sticky posts in full and all others with excerpts.
- The topic ‘Adhesive plugin not working’ is closed to new replies.