shaunincali
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Edit RSS Feed TitleThanks Esmi! It must’ve gotten cached somehow in my RSS Reader or something…
It is showing now – YAY!
Forum: Fixing WordPress
In reply to: Style sub pages relative to parentFixed some bugs with current page and current page parent…
Just in case you attempt this:
<!-- List pages for navigation - Note that menu_order is defined in WordPress Admin --> <?php //This funtion allows you to find text between any marker text //This allows us to find the pade ID for the parent pages function ExtractString($str, $start, $end) { $str_low = strtolower($str); $pos_start = strpos($str_low, $start); $pos_end = strpos($str_low, $end, ($pos_start + strlen($start))); if ( ($pos_start !== false) && ($pos_end !== false) ) { $pos1 = $pos_start + strlen($start); $pos2 = $pos_end - $pos1; return substr($str, $pos1, $pos2); } } $parents = wp_list_pages("sort_column=menu_order&title_li=&title=&depth=1&echo=0"); //get parent pages $parents_arr= explode("\n", $parents); //put parent pages into an array $howmanyparents = count($parents_arr); // find out how many parent pages are in the array for($i=0;$i<($howmanyparents - 1);$i++){ //Go through each parent to find the children for that parent $trimmedparent = str_replace('</li>','<ul> <div class="place'.($i -1).'">',$parents_arr[$i]); //replace the closing <li> from the parent with a <ul> for the sub-list and the custom div here. $pagelist = $pagelist.$trimmedparent; //Add the current parent to the output list of pages - this is where we start rebuilding the wp_list_pages output If(stristr($parents_arr[$i], 'current_page_item"') !== FALSE || stristr($parents_arr[$i], 'current_page_parent"') !== FALSE) { //If the parent is the current page item or parent we have to search for the page ID in a different way because the current page/parent has no trailing quote after the page ID in the link $parentid = ExtractString($parents_arr[$i], 'page-item-', ' '); //Find the ID of the "current page item" Parent page assigned by WordPress via the "page-item-" part of the link } Else { $parentid = ExtractString($parents_arr[$i], 'page-item-', '"'); //Find the ID of the Parent page assigned by WordPress via the "page-item-" part of the link } $children = wp_list_pages("title_li=&child_of=".$parentid."&echo=0"); //Get the list of children for the current parent using wp_list_pages and the parent's ID if($children == "") {$children = "<li> ";} $pagelist = $pagelist.$children; //Add children to the pagelist $pagelist = $pagelist.'</div></ul></li>'; // Close the custom div, sublist, and original parent list item before continuing to the next parent and children } echo $pagelist; ?>
The output looks like this:
<ul> <li> Parent 1 <ul> <div class=Parent1> <li> Sub 1 </li> <li> Sub 2 </li> </div> </ul> </li> <li> Parent 2 <ul> <div class=Parent2> <li> Sub 1 </li> <li> Sub 2 </li> </div> </ul> </li> </ul>
Forum: Fixing WordPress
In reply to: Style sub pages relative to parentOkay, nobody out there has tried this huh? I figured it out, but I’m sure my code isn’t the best and there’s probably a better way to do this. Hopefully this will help someone in the future
<?php //This funtion allows you to find text between any marker text //This allows us to find the pade ID for the parent pages function ExtractString($str, $start, $end) { $str_low = strtolower($str); $pos_start = strpos($str_low, $start); $pos_end = strpos($str_low, $end, ($pos_start + strlen($start))); if ( ($pos_start !== false) && ($pos_end !== false) ) { $pos1 = $pos_start + strlen($start); $pos2 = $pos_end - $pos1; return substr($str, $pos1, $pos2); } } $parents = wp_list_pages("title_li=&depth=1&echo=0"); //get parent pages $parents_arr= explode("\n", $parents); //put parent pages into an array $howmanyparents = count($parents_arr); // find out how many parent pages are in the array for($i=0;$i<($howmanyparents - 1);$i++){ //Go through each parent to find the children for that parent $trimmedparent = str_replace('</li>','<ul> <div class="place'.($i -1).'">',$parents_arr[$i]); //replace the closing <li> from the parent with a <ul> for the sub-list and the custom div here. $pagelist = $pagelist.$trimmedparent; //Add the current parent to the output list of pages - this is where we start rebuilding the wp_list_pages output $parentid = ExtractString($parents_arr[$i], 'page_id=', '"'); //Find the ID of the Parent page assigned by WordPress via the "page_id=" part of the link $children = wp_list_pages("title_li=&child_of=".$parentid."&echo=0"); //Get the list of children for the current parent using wp_list_pages and the parent's ID $pagelist = $pagelist.$children; //Add children to the pagelist $pagelist = $pagelist.'</div></ul></li>'; // Close the custom div, sublist, and original parent list item before continuing to the next parent and children } echo $pagelist; ?>
Forum: Requests and Feedback
In reply to: Feature Request – PERMISSIONS – Category or PageI agree with this. If you want to have user-generated content for one section of your blog it make it a WHOLE lot easier to restrict by category than to run two separate WordPress installs.
TikiWiki has a VERY granular way of doing this. I don’t think you need that level of granularity, just using the default roles for permissions on categories would usually be sufficient and should be an easy include.