Jump to content

FreeAgent

Members
  • Posts

    6
  • Joined

  • Last visited

FreeAgent's Achievements

Newbie

Newbie (2/6)

1

Reputation

  1. Thank you so much, Horst! You've went above and beyond helping me out. I wish I could buy you a beer. I'm great with frontend code, but I get lost in PHP real quick. I'm picking up a book today so I can learn a few things.
  2. I'm running into issue trying to sort the renderNav function. Here is the default code... function renderNav(PageArray $items) { // $out is where we store the markup we are creating in this function $out = ''; // cycle through all the items foreach($items as $item) { // render markup for each navigation item as an <li> if($item->id == wire('page')->id) { // if current item is the same as the page being viewed, add a "current" class to it $out .= "<li class='current'>"; } else { // otherwise just a regular list item $out .= "<li>"; } // markup for the link $out .= "<a href='$item->url'>$item->title</a>"; // if the item has summary text, include that too if($item->summary) $out .= "<div class='summary'>$item->summary</div>"; // close the list item $out .= "</li>"; } // if output was generated above, wrap it in a <ul> if($out) $out = "<ul class='nav'>$out</ul>\n"; // return the markup we generated above return $out; } I'm wanting it to order the pages from newest to oldest. The code above list oldest to newest. Can anyone help me out with this?
  3. I figured it out. If anyone else is trying to do this here was the very simple change to get it working... if ($page->parent->name == "blog") { echo "social share stuff"; }
  4. After taking another look I still have a problem. I don't want the echo to trigger on blog. I want it to trigger on blogs children only. In a nutshell I'm using the defult profile. This profile uses _main.php as its central template. I'm trying to write some code that will only display the comments section on blog entry pages. These pages are the children of blog.
  5. That worked perfectly, Pauline! Thank you so much for your help. I need to get better with PHP.
  6. I'm just getting started with ProcessWire using the Default Profile. Thus far everything is working out great even with my very limited PHP knowledge. Right now I'm trying to wiggle a basic blog into my setup. I've setup a page called blog, and I have 2 test post pages as children of blog. In the sidebar on blog post pages only I want to show social sharing elements. I'm currently using the following code... if($page->rootParent->hasChildren) { echo "social share stuff"; } I have 2 problems with this. 1. This echo will display on both the parent and its children. I only want to echo on the child pages. 2. The code above will echo on all parents that have children. I only want this echo to trigger on children of blog. Can anyone help me out with this please?
×
×
  • Create New...