WordPress.org

Ready to get started?Download WordPress

Forums

Content Aware Sidebars
Sidebar not working with custom post type (21 posts)

  1. coloradoouting
    Member
    Posted 2 years ago #

    Hello Joachim,

    This is a great plugin that has worked perfectly until just recently when we started using the All in one event calendar plugin. It seems as if the custom post taxonomies are not being seen by CAS. Only the default sidebar will appear on our event posts. I've been through the setting multiple times to assure all is well there. I noticed the post by Marfarma regarding "Custom Post Types not seen when created by plugin", but we're using V0.7, so I've discounted there being a problem there. Could the confusion be related to our event template being named single-ai1ec_event.php? I'm probably reaching for straws with that idea. Obviously, I could use your insight. Any direction that you could provide would be greatly appreciated!

    Thanks!
    Mike

    http://wordpress.org/extend/plugins/content-aware-sidebars/

  2. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for your feedback. The plugin does support custom post types and taxonomies, but the deal is, that even though the plugin is set to be loaded very late in order to support other plugins introducing custom post types and taxonomies, some plugins might be loaded even later. I'm not sure if this makes sense to you, and I don't know if that is the problem in this case, but it is the first thing that crossed my mind.

    Does the custom post type and custom taxonomy appear in the sidebar editor? If not, the problem is probably caused by what I mentioned before.

    I'll look into the issue later and try to reproduce it, but I am pretty sure that your template name has nothing to do with it.

  3. coloradoouting
    Member
    Posted 2 years ago #

    Thanks for the reply Joachim! I don't have a full understanding of the loading process, but I get the concept. That's what Marfarma's post was referring to, isn't it? I can see where that could cause a problem.

    The CPT post and taxonomy all appear in the sidebar editor...hang on, I just tried selecting the event post itself from the sidebar editor list and that worked! (Sorry, I should have tried that prior to posting so that you could have all the facts.)

    That definitely gets me out of a bind, but having to go in and select each post isn't as convenient as selecting a category or tag. So with this information in hand, what do you think? Could this be a loading order problem? And if so, how could I go about fixing that?

    Thanks for all your help!

  4. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    I just reread the post you are referring to, and yes it is what he refer to, however, the problem back then was that I'd made it impossible for any custom post type or taxonomy to be loaded before this plugin. Of course this was fixed.

    I have unfortunatly not been able to reproduce your problem with the newest version of All-in-one Event Calendar. When you are in the sidebar editor, the following three meta boxes will appear when using All-in-one Event Calendar: Events (middle), Event Categories (side) and Event Tags (side).

    In the Events meta box you can choose what specific events the sidebar should be shown with or tick "Show with All Events" to show the sidebar with all events.

    Have you tried "Show with All Events"?

    In the Event Categories meta box you can choose what events containing specific event categories the sidebar should be shown with or again tick "Show with Event Categories" to show the sidebar with events containing any event categories. It is the same concept for Event Tags.

    Have you tried "Show with Event Categories" or "Show with Event Tags"?

    I did find a bug though. If you have picked custom taxonomies for the sidebar, you cannot remove them all again. I'm not sure if this is what is causing your problems, but it is of course fixed in the next version.

    If none of the things I've suggested work, I'm pretty much out of good ideas. Could be other plugins that somehow cause the trouble. It shouldn't be a loading order problem though, as you've confirmed that the meta boxes do appear in the sidebar editor.

  5. coloradoouting
    Member
    Posted 2 years ago #

    Was just running debug and recieved this message: Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/---/public_html/wp/wp-content/plugins/content-aware-sidebars/content-aware-sidebars.php on line 410

    Does that shed any light on things?

    Regarding your last post:
    Selecting a category or tag, show with all categories or show with all tags has no effect on sidebar.

    Select the individual event in the event metabox or show with all events and the sidebar works.

    Just to be clear, sidebars work flawlessly with Posts and Pages. This issue only occurs with the custom post type generated by All in one events calendar

    Thanks for all your insight, hope the error message noted above helps to narrow this down.

  6. coloradoouting
    Member
    Posted 2 years ago #

    A quick off topic question.. In the All Posts view, is it possible to have a column that shows which sidebar is assigned to the post, page, etc..?

    Thanks!

  7. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the debugging. What your warning say is that 1) the host sidebar you're trying to merge with does not exist (in the database) or 2) the host sidebar is simply not an array (which it really ought to be).
    I have been able to reproduce your bug under the following circumstances:

    1st circumstance:

    1. Clear all instances of widgets and sidebars in the database
    2. Create new content aware sidebar that merges with host (sidebar-1) from the top

    This will give the following notice and warning:

    Notice: Undefined index: sidebar-1 in ... on line 410
    Warning: array_merge() [function.array-merge]: Argument #2 is not an array in ... on line 410

    However, this error will dissappear when you add a widget to any of your sidebars, as this would create an instance in the database again. This shouldn't be the cause of your problem.

    2nd circumstance:

    1. Create a content aware sidebar (1) with some random host
    2. Create another sidebar with (1) as a host, merging with it from the top.
    3. Remove sidebar (1)
    4. Remove all inactive widgets belonging to (1) and add a widget to a random sidebar (to update the database)

    This will give the same errors as above, only with another sidebar id. It is more likely that this might be your issue. However, the error is only reproduced ca. 1/2 times and I can't really see how this is what is causing your problem as there - as far as I can see - is no difference in selecting Events or Event Tags/Categories for the specific sidebar.

    IF this is the problem, I suggest that you check that your host sidebar exist and that you drag and drop some widgets around in order to update the databsae correctly.

    About your other question, I have thought about adding the selected rules to the overview before, but I haven't found out how to show them in a clear way yet. It is definitely a good suggestion though.

  8. JasperSch
    Member
    Posted 2 years ago #

    I'm having the same issue. Just reverted to 0.7 and this fixes the issue.

    Custom post types made using the Custom Post Types plugin work fine, but events from the Event Manager plugin cause one sidebar being shown incorrectly when a condition for another sidebar is true.

    One sidebar should only merge below secondary aside on the front page but is now shown on single event pages where conditions for another content aware sidebar are true.

    The changelog might suggest:

    0.8
    Added: some rules are dependent of each other if present

    Is causing issues? Of course the order of plugin calls might also cause problems.

    Any ideas?

  9. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for your feedback. The warning I reproduced for @coloradoouting should've been fixed in 0.8, so at least this is not the actual problem.

    Also, you're not using the same event plugins (All In One Event Calendar and Event Manager) and I wasn't able to reproduce the custom taxonomy problems that @coloradooutin had.

    I'll see if I can reproduce what you're experiencing, but I'll be rather busy in the next couple of weeks, so I can't say when.

    The addition you refer to could be what is causing the trouble, since it works for you in 0.7. If it is, it means that I haven't tested it thoroughly enough :(
    The feature means that if you've selected both "Show with all <post type>" and an specific author, the sidebar will only be visible with the singulars that are written by that author AND are of that post type.
    Before 0.8, selecting the same thing would mean that the sidebar was shown with the singular of that post type OR the singular made by that author.
    I know this would definitely cause some users' existing sidebars to behave differently after the update, but at the same time this dependency makes content aware sidebars even more flexible.
    Note that not all rules are dependent yet, I think I'd only made it for post types, authors and page templates. If I get lots of complains about this, I'd consider to change it back.

  10. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    Hi again. I just did a quick check and indeed there was a bug causing all post types with taxonomies to get wrong sidebars. And it was because of the new dependent rules. Taxonomies don't make use of these new rules yet, that's why it caused some trouble. Stupid errors like this really should be caught in the tests I do before release. I'm sorry about that!

    I'll release 0.8.2 in a minute, which fixes it.

    I still haven't been able to find the cause of Mike's problems yet though.

  11. JasperSch
    Member
    Posted 2 years ago #

    Hi Joachim,

    Sorry for bumping this old thread. Just updated to 1.0 and it seems that you now fully rolled out the AND rule, as indicated in the changelog:

    Fixed: all present rules now dependent of each other

    One sidebar is used for:
    Custom post type Company
    Custom post type Job
    Page Career
    Event category Career
    Post category Career
    Exposure Singular & Archives

    Now none of this should be causing issues, since there are never two rules applicable at the same moment. However, still the sidebar only on some occasions (even for some companies it does, while for others it doesn't).

    Could you please check the code or otherwise roll back the OR function? It is too cumbersome for us to make sidebars separately for each of these rules.

    Thanks a lot for your great work!

  12. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the feedback. All rules are dependent of each other, when present in the content, yes. This means that Pages will not be influenced by Taxonomy rules (even if set in a sidebar), as they don't support any. Custom Post Types supporting (any) taxonomies will be influenced - my guess is that's why you now see another result for your sidebar settings.

    This was done by design and is not a bug, though I do know that it might cause some UX problems when upgrading from an earlier version.

    Now, I've thought a lot about this - also before releasing version 1, and I know that though the rules can now be displayed with a combination of specific content (which I have aimed for), it has caused some limitations as well. These limitations can be removed in several ways, where I have boiled the best solutions down to:

    1) Add a "dependency" setting, letting users decide whether their rules should be dependent or not.
    2) "Group" rules together and let sidebars contain several "rule groups".

    Even though I'd have to change a lot to implement both of these, 1 is the easiest, but might be the worst of them if comparing their performance. For 2 to happen, I'd say that the core of the plugin would have to be totally rewritten.

    I'm liking the idea of 1 more and more, but tell me what you think. Users' feedback mean a lot for the development of this plugin, and without it, it's quite hard to make any decisions when knowing that it might make some users frustrated, but without knowing how big the group of excited users will be.

  13. JasperSch
    Member
    Posted 2 years ago #

    Hi Joachim,

    Still, I think the 'discussion' is twofold:

    - Dependency of rules (which should not be an issue on our site), whether this is desirable or not.
    - We aim to use one sidebar on multiple post types, and for some post types (events and posts) only if a certain taxonomy (event category and category respectively) is chosen. I guess that somewhere in the plugin, the taxonomy requirements get mixed up, since of course a certain event (or company) can never fulfil taxonomy rules on taxonomies the post type does not support. Could you recheck how the plugin deals with multiple taxonomies, each for different post types?

    I agree that when a post type supports e.g. two taxonomies and both taxonomies have a rule, that both rules should be satisfied for the sidebar to show (dependency setting). However, on our site only one taxonomy is applicable at each moment.

    Thanks for the quick response.

  14. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    This might be a bug, however, do Company or Job support any taxonomy type? If they do, that is the reason.

    When handling the taxonomies, the following is done in the code:
    Does this content support taxonomies, if yes, which, if no, stop.
    Does this content have any terms of the supported taxonomies, if yes, which, if no, stop.
    Sidebars containing either no taxonomy rules, the taxonomies or the terms (while complying with the other content rules) are pulled from the database.
    This means that if the current content, e.g. post of type Job or Company, have any taxonomies/terms, and these are not set in the specific sidebar rules, the sidebar will not be shown.

    The plugin do not know how content are related to each other, but simply use procedures like the abovementioned. Sure, it would be better to relate content properly, but I've not come to an efficient solution on how to do this while keeping all the data in the post_metadata table.

    Taxonomies are, sadly, not dependent of each other yet. This feature will definitely come some day though.

  15. JasperSch
    Member
    Posted 2 years ago #

    Hi Joachim,

    Your reply has allowed me to isolate the 'bug'.

    If I abstain from using taxonomy rules, indeed the sidebar shows with custom post types Company and Job (which support taxonomies but with no sidebar rules set on them).

    However, if I then add a taxonomy rule on another post type Event (e.g. only show sidebar with events of event category Career), the sidebar disappears from Company and Job pages. Moreover, it doesn't show on Event pages with the appropriate event category.

    And it shows up again on Company and Job archive pages... And randomly on some single Company pages?

    I've not been able to find for which companies it shows and for which it doesn't...

  16. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    The first thing is by design, as explained in the previous post. The reason for second thing happening - why the sidebar will not show on the event pages with the specified event category - is that you, I assume, tell the sidebar to be shown with: All company pages, All Job pages and event category Career. As the rules are dependent, the content will have to meet these exact rules. That is, a company page or a job page with the event category Career.

    Logically, this cannot ever be met, but the plugin does not know that - it only does what you tell it to do.

    As e.g. taxonomies and post types are not dependent of each other in the archive pages, the rules are not dependent here.

    I cannot explain why the sidebar is shown on some specific company pages. What are the supported taxonomies for this post type?

  17. JasperSch
    Member
    Posted 2 years ago #

    Supported taxonomy for Company post type is only Industries. Taxonomy is set for all Companies. If I check 'Show with all Industries', then the Company will still have to be with event category Career, right?

    I understand your idea about the logic of the plugin, so thanks for making clear that indeed our condition can't be met.

    Under your reasoning, I can't wait for the independency setting ;). Adds enormous flexibility and also allows for sidebars shown on a wide variety of pages, like ours for Career. I'd even argue that sidebars with independent rules are more common than with dependent rules, as complex dependent rules can be appropriately enhanced by specific styles in CSS, rather than by added HTML through your plugin.

    Thanks.

  18. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 2 years ago #

    If you check both supported (Industries) and unsupported (Event category) taxonomy types, it should work. The rules are independent when it comes to content of the same type (i.e. checking pages and posts will not mean that the content would have to be of both page and post type). So when you set an appropriate taxonomy, it will work. Remember this:

    Does this content support taxonomies, if yes, which, if no, stop.
    Does this content have any terms of the supported taxonomies, if yes, which, if no, stop.
    Sidebars containing either no taxonomy rules, the taxonomies or the terms (while complying with the other content rules) are pulled from the database.

    And you might be right about most users wanting independent rules, so I'll see if this can be implemented soon. However, as I'd seen more sidebar plugins with this basic feature, I thought it could be nice to add more complexity, so this plugin would stand out. Also, sometimes rules have to be dependent of each other, e.g. for multilingual content.

    I appriciate your feedback.

  19. JasperSch
    Member
    Posted 2 years ago #

    Hi Joachim,

    Is there any chance that the independence option will be rolled out any time soon?

    We are starting to rely more and more on this great plugin and need one sidebar (career as mentioned earlier) to appear with a wide variety of content (different taxonomies and different content types).

    The plugin truly adds value to our website and we would love the roll-out.

    Thank you,
    Jasper

  20. Joachim Jensen (Intox Studio)
    Member
    Plugin Author

    Posted 1 year ago #

    Development has not yet begun, and unfortunately I cannot say anything about an eta. I have, however, thought about the solutions stated earlier in this thread, and while the "independence option" should be easier to implement, I am afraid that it would be too bad for performance. Technically, right now most "content aware logic" is done in SQL, and if each sidebar can have an independence option, much of this logic has to be moved/copied to PHP and done for every sidebar, which can lead to a bad (slow) running time in the algorithm.
    Therefore, I'm thinking more and more about the Rule Groups solution, that will be much more flexible but also much more advanced.

    It's great to hear that you find the plugin usable, and obivously I would like you to keep using it. I suggest that you downgrade the plugin to the version that met your requirements, or I can send you a tweaked version of the current version, where the content dependence is removed

  21. JasperSch
    Member
    Posted 1 year ago #

    Looking forward to any upgrades and will check next time whether Rule Groups are rolled out. For now: don't worry, I've rolled back to the non-dependent version. Working like a charm. Thanks for all the efforts!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic