themichaelglenn
Forum Replies Created
-
Thanks. I actually did some more reading, and I found a really cool tutorial on how to create a tinyMCE plugin: Dissecting the WordPress TinyMCE Editor.
I have to say, I don’t understand all the code there, but I’m comfortable enough with copy and paste that I think I can use that to accomplish what I want. 🙂 (Which is cool, because just a few months ago I was intimidated by all this stuff, but now it’s *starting* to come easier!)
Perhaps if I’m successful in this attempt, I will read up more on actions and filters, and explore the idea of developing a companion plugin.
Yes, all pages, posts, and forum posts associated with the game ‘Final Fantasy’ would share the term ‘final fantasy.’ Likewise, all pages, posts, and forums associated with, say, ‘Mario Kart,’ would share the term ‘mario kart.’
(It was the only way I could think of to get the results I wanted.)
I may be using your plugin a bit differently than most:
On “Game” Pages, I use two widgets; one to show 5 related forum topics, and one to show 5 related blog posts.
On “Forum” Topics, I use three widgets; one for 5 forum topics, one for 5 blog posts, and one for 5 pages.
Then, on “Blog” Posts, I also use all three widgets.(On my “Game” Pages, I have another plugin that displays the menu for all pages for that particular game, i.e. ‘final fantasy’ world map, location walkthrough, hints and tips, etc. And they’re all displayed heirarchically – if that’s a word? – anyway those links work the way I want them to on the “Game” pages… and with your plugin to take care of all the rest, I’m very satisfied now with how the rest of the related content links appear.)
I added Page support to the widget, by the way, and for the moment I think I’m satisfied with showing 5 related pages, rather than links to the specific child pages. However, if I had an option to show the specific child pages instead, then what I would do is to ask my members if ‘choice a’ worked better than ‘choice b’ (but I don’t want to offer two choices, unless I know I can deliver on the specific child pages if that’s the one they choose.)
So, if there’s an easy workaround to use your plugin/widget to show the top level child pages (or, rather, the children of the top level parent page), that would be great. But if it’s gonna take you a ton of effort, then I wouldn’t bother.
Like I said, overall I’m very satisfied with this plugin.
Holy smokes I think the example for using your own template is a bit over my head!
Anyway, let me see if I can do a better job explaining what I meant. I run a gaming site that’s split into three main sections: Games, Forums, and Blog.
Games – this is where all the game “pages” are. Pages are heirarchical (naturally), and the page with the “name of the game” is the top level parent. (For example, if the game was Final Fantasy, the top level parent page would be “final-fantasy.”)
Next, the child pages. Games that have child pages have something like the following:
Hints and Tips
Location Walkthrough
Skill ListNow, within each child page, there are pages that relate to that subject. So, if there’s a location walkthrough page called “Home Town,” it would under “final-fantasy/location-walkthrough/hometown.” Whereas a skill list for, let’s say, a black mage, would be “final-fantasy/skill-list/black-mage.”
Then of course there’s the bbPress forum, and the blog (which only contains “posts”). I assume those sections are self-explanatory.
What I was thinking in terms of my “Game” pages and your plugin, was that if someone is reading a forum topic or a blog post on “Final Fantasy,” it would be nice to have links to the Final Fantasy child pages, i.e.:
Hints and Tips
Location Walkthrough
Skill Listinstead of random links to random Final Fantasy pages that could be anywhere in the hierarchy…
But, having installed your plugin and seen how it works with posts, forums and topics, I think I’d actually be just as happy if you could simply add support for “pages” – even if the result was a “random” list of related pages anywhere within the same taxonomy.
(I actually can sort of see how that could be better, anyway, because the exact pages the plugin would come up with would probably be more closely related to the specific forum topic or blog post… so my original thought may not have been all that great to begin with.)
I hope that makes it more clear, and that you can help me find a way to add page support to an otherwise perfect plugin.
I just found the topics post type in the widget, so sorry… It does work now on topics, as long as the topic has been assigned to the correct taxonomy.
As for the rest of my question – I also found the widget settings that let me choose between post, forum, topic, and reply, so that’s all working properly as well. (I should have found all that before writing this post, so that’s my fault for not checking everything out…)
So the only thing I want to do now, that the plugin doesn’t do, is show links to related “pages” – but, I only want to show the links to the first-child pages of the top level parent page within that taxonomy.
Right now I’m only playing with the plugin on a development site, but if I take it live and have any problems I’ll give the live URL.
- This reply was modified 8 years, 7 months ago by themichaelglenn. Reason: Further explanation of what I want to achieve
Forum: Fixing WordPress
In reply to: How to let users tag pagesUnfortunately I’m using the comments section for a paid “user reviews” plugin, so that’s not an option.
Beyond that, I don’t even know where to begin to search for the code that would allow for this kind of feature.
I’m sure I’m in way over my head on this one, but… short of taking the time to learn to code what I want, is there a way to take the basic “Tags” box that shows up on the post edit admin screen (or page edit, in this case), and make that box publicly accessible on the pages of my choosing? So that my logged in front end users can tag the page that way?
Or, do you know if any of the front end content submission plugins might allow something close to this?
If anyone can point me in the right direction I’d really appreciate it, but if the answer is “learn to code and then come back when you know what you’re doing,” well, I can accept that as well.
(Also, I just noticed that this question got posted in “Fixing WordPress,” but I’d meant to post it in “Developing with WordPress.” I don’t know if that matters, or if it can be moved between forums, or if it’s now forever stuck in the wrong place?)
- This reply was modified 8 years, 12 months ago by themichaelglenn. Reason: typo
Forum: Developing with WordPress
In reply to: Previous and Next links on child and grandchild pagesThanks. I don’t see that I’ll need this code on any other pages, so I’ll just leave it where it is.
This website is the first successful site I’ve ever built, and it’s also kind of my “labratory” for learning web design, so right now as long as the code works, I’m happy with it – but as I progress, if there’s a better way to do this I’d definitely like to know. This one took me about a week of googling all sorts of strange things just trying to figure out what questions to ask in the first place, and even then I had to do a LOT of “trial and error” before I found the right variables. 🙂
Forum: Developing with WordPress
In reply to: Previous and Next links on child and grandchild pagesThanks, but I don’t entirely follow what you’ve written. (I just don’t have enough experience yet with WP or with PHP…)
I did find a way to do what I want, but I suspect the code could be neater. Right now, it’s all in my page.php and I imagine most of it should be moved to my functions.php but I’m not entirely sure.
This is what I’ve put in the Loop, right after get_template_part (oh, and I’m using a child theme of TwentySixteen, if that’s important):
To get the top level parent
global $post; /* Get an array of Ancestors and Parents if they exist */ $parents = get_post_ancestors( $post->ID ); /* Get the top Level page->ID count base 1, array base 0 so -1 */ $id = ($parents) ? $parents[count($parents)-1]: $post->ID; /* Get the parent and set the $class with the page slug (post_name) */ $parent = get_post( $id );To ‘mark’ the first child, last child, and last grandchild
$page_childs = get_pages( 'child_of=' . $id . '&sort_column=menu_order&sort_order=ASC' ); $first_child = $page_childs[0]; $page_childs = get_pages( 'child_of=' . $id . '&sort_column=menu_order&sort_order=DESC' ); $last_child = $page_childs[0]; $page_childs = get_pages( 'child_of=' . $last_child->ID . '&sort_column=menu_order&sort_order=DESC' ); $last_grandchild = $page_childs[0];To only show “Next” on the first child (but only if there are more children after it; otherwise, do nothing):
if ( get_the_ID() === (int) $first_child->ID && get_the_ID() === (int) $last_child->ID && (! has_children() )) { } elseif ( get_the_ID() === (int) $first_child->ID ) { getNext(); }To show “Previous” on the last child, or “Previous” and “Next” if the last child has its own children:
elseif ( get_the_ID() === (int) $last_child->ID && (! has_children() )) { getPrev(); } elseif ( get_the_ID() === (int) $last_child->ID && ( has_children() )) { getPrev(); getNext(); }in which case I want to show “Previous” on the last grandchild:
elseif ( get_the_ID() === (int) $last_grandchild->ID ) { getPrev(); }Then, finally, show “Previous” and “Next” on all pages in between:
else { getPrev(); getNext(); }Then I put these functions at the bottom of my page, after the get_footer:
function has_children() { global $post; return count( get_posts( array('post_parent' => $post->ID, 'post_type' => $post->post_type) ) ); } function getPrev(){ $pagelist = get_pages('sort_column=menu_order&sort_order=asc'); $pages = array(); foreach ($pagelist as $page) { $pages[] += $page->ID; } $current = array_search(get_the_ID(), $pages); $prevID = $pages[$current-1]; $nextID = $pages[$current+1]; echo '<div class="navigation">'; if (!empty($prevID)) { echo '<div class="alignleft">'; echo '<a href="'; echo get_permalink($prevID); echo '"'; echo 'title="'; echo get_the_title($prevID); echo '">« '; echo get_the_title($prevID); echo '</a>'; echo "</div>"; } }(I also have a function for getNext(), but it’s just getPrev() with $nextID instead of $prevID.)
- This reply was modified 8 years, 12 months ago by themichaelglenn. Reason: minor correction
Forum: Plugins
In reply to: [Inline Image Upload for BBPress] Warning message when submitting topicThe update works perfectly! I can now upload an image, click on the image and select “Edit,” and set the Align, Link To – AND – write a caption, all before Submitting the post.
I’m amazed at your quick response time, and will definitely be taking a look at your pro version when it comes time for me to take this site live (well, the WordPress version of the site, that is…)
Thank you so much!
Forum: Plugins
In reply to: [Inline Image Upload for BBPress] Warning message when submitting topicAwesome I will plan on trying it out tomorrow and let you know how it goes. Thanks for the fast response!
Forum: Plugins
In reply to: [Inline Image Upload for BBPress] Warning message when submitting topicI found the problem!
I’m adding links to my images, in the following manner:
After I upload the image, I click on it, and then click on the “Edit” button (the one that looks like a pencil), and I set the
Display SettingstoLink To Image URL.Then, when I click Submit, the code is stuck trying to sort out the temp directory, and the final image directory – and of course, at that point the image (the ‘file’ in my warning message) only exists in one directory. So, WordPress can’t match up the link with the image.
If I submit the post without linking to the URL, everything works fine, and I get no warning messages. From there, I can edit the post, and add a link, and it saves the post and the link works.
I really want to be able to link to the image URL, but I can’t see having to tell my users to save the post first, then go back and add a link. Of course the sensible approach is to just not link the images, and go with a lightbox effect instead, so I may end up going that route.
(I’m glad I was able to poke around a bit, and figure out what was causing this!)
Forum: Plugins
In reply to: [Inline Image Upload for BBPress] Warning message when submitting topicHi,
The image shows up in the post editor, and if I press the “back” button on my browser (after submitting the post and seeing the warning message), it takes me back to the editor, with my message still intact – but, the message has also been posted to the forum.
Also if I navigate back to http://rpginsanity.com/beta/forums/ and then find the same topic again, all the posts and images etc. are there.
- This reply was modified 9 years, 6 months ago by themichaelglenn.
Forum: Plugins
In reply to: [Advanced Sidebar Menu] Advanced Sidebar Menu problemMy apologies, I gave incorrect information in my last post. Placing the code in Advanced_Sidebar_Menu.php actually does nothing; I had to put it in the List_Pages file (also in the “src” folder.)
So what I wound up with is this:
// sanitize, mostly to keep spaces out if( is_string( $args[ 'exclude' ] ) ){ $args[ 'exclude' ] = explode( ',', $args[ 'exclude' ] ); } $args[ 'exclude' ] = preg_replace( '/[^0-9,]/', '', implode( ',', apply_filters( 'wp_list_pages_excludes', $args[ 'exclude' ] ) ) ); // I added these lines: if ( is_buddypress()) { die; } if (( is_page() || is_singular())) { $this->current_page = get_queried_object(); $this->current_page_id = $this->current_page->ID; } $this->args = apply_filters( 'advanced_sidebar_menu_list_pages_args', $args, $this ); // and these: ?><aside id="nav_menu-2" class="widget widget_nav_menu"> <h3 class="widget-title"><?php echo get_the_title( $this->top_parent_id ) ; ?> </h3> <?php }It seems to prevent the menu from loading, but it also hides the floating admin bar on the Profile pages and member Forums pages. But I plan on disabling the admin bar anyway, so hopefully that won’t be a problem when I take this site live. 🙂
Anyway, I’m sure that what I’ve done is not the “best” way to deal with this issue. If there is a better, or safer, method, I’d love to hear about it.
- This reply was modified 9 years, 7 months ago by themichaelglenn.
Forum: Plugins
In reply to: [Advanced Sidebar Menu] Advanced Sidebar Menu problemSo I did a lot more reading, and if I understand correctly, it seems that BuddyPress renders their pages in a way that’s different from WordPress pages. I suspect that was one of the factors I ran into, though to be honest I don’t completely understand how it all works.
I definitely don’t really know what I’m doing, but I found the Dynamic Widgets plugin, and that prevented Advanced Sidebar Menu from loading on all BuddyPress pages except the member Profile pages, and the member Forum pages (don’t know why it wouldn’t recognize those two, but it didn’t.)
I did some more digging, and finally discovered that if I add:
if (is_buddypress()) { exit; }to the top of the Advanced_Sidebar_Menu.php page in the “src” folder, then the plugin works perfectly on my WordPress pages, and doesn’t show at all on any BuddyPress pages (which is exactly what I wanted.)
It seems there’s also a method for disabling the sidebar completely in a BuddyPress child theme – and even a way to register a separate sidebar (in which, the Advanced Sidebar Menu plugin would do nothing, because it wouldn’t even be assigned to that specific sidebar).
I found a lot of forum topics that touched on that subject, but I cannot seem to find clear, step by step instructions on how to do this (which is not to say the instructions don’t exist – I simply and honestly don’t know where to look for them.)
Anyway, I found “a way” to accomplish what I wanted, but I have no idea if it’s the best way – or for that matter, if it’s even a “good” way.
Any advice you could offer would be greatly appreciated.
Forum: Plugins
In reply to: [Advanced Sidebar Menu] Advanced Sidebar Menu problem@mat-lipe I’m having trouble with this plugin, and I just registered with wordpress.org so I can’t seem to create a new topic of my own. Sorry to hijack this one but I’m really stuck.
First off, I’m fairly new to WordPress. I’m planning to migrate a site from Joomla 3.4, and I’ve spent the last month building and rebuilding demo sites on my pc, so I’m really just scratching the surface and I may be way out of my league here. 🙂
I setup Advanced Sidebar Menu to show menus based on pages – and I even figured out how to hack the code to give the menu a dynamic title based on the top page. (Note that I literally only have 6 hours of php experience, so figuring out how to do that took me about two days lol, but anyway here’s the code for what I accomplished.)
The first line is your code from the src -> Advanced_Sidebar_Menu_List_Pages.php on line 172; the rest was how I got the title to display what I wanted:
$this->args = apply_filters( 'advanced_sidebar_menu_list_pages_args', $args, $this ); ?><aside id="nav_menu-2" class="widget widget_nav_menu"> <h3 class="widget-title"><?php echo get_the_title( $this->top_parent_id ) ; ?> </h3> <?phpSo getting a dynamic title was pretty awesome – but unfortunately I have a problem which is there whether I take my code out, or leave it in.
I’m running BuddyPress 2.6.2, and on my Members page, Groups page, and all individual member pages and group pages, I get a dynamic list of every page on my site. I’ve tried excluding those pages by their ID, and I’ve also tried setting the widget to Hide if Page is Members, Groups, etc. There doesn’t seem to be any way to turn this off.
I’ve also tried to exclude other pages (the ones I actually want it to show on), and the widget does not exclude them, either. However, I can “Hide if Page is” on those other pages, just not on Members or Groups.
FWIW, I’m using WordPress 4.6 with the Customizr theme (although I tried a few other themes and had the same problem with all of them), and I have Advanced Sidebar Menu 6.1.0.