Title: csleh's Replies | WordPress.org

---

# csleh

  [  ](https://wordpress.org/support/users/csleh/)

 *   [Profile](https://wordpress.org/support/users/csleh/)
 *   [Topics Started](https://wordpress.org/support/users/csleh/topics/)
 *   [Replies Created](https://wordpress.org/support/users/csleh/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/csleh/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/csleh/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/csleh/engagements/)
 *   [Favorites](https://wordpress.org/support/users/csleh/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 288 total)

1 [2](https://wordpress.org/support/users/csleh/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/csleh/replies/page/3/?output_format=md) …
[18](https://wordpress.org/support/users/csleh/replies/page/18/?output_format=md)
[19](https://wordpress.org/support/users/csleh/replies/page/19/?output_format=md)
[20](https://wordpress.org/support/users/csleh/replies/page/20/?output_format=md)
[→](https://wordpress.org/support/users/csleh/replies/page/2/?output_format=md)

 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [target grandchildren (add style?) in get_pages list](https://wordpress.org/support/topic/target-grandchildren-add-style-in-get_pages-list/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/target-grandchildren-add-style-in-get_pages-list/#post-11008493)
 * something clicked today and I got it!
 *     ```
       <?php //get first level child pages 
       		$mypages = get_pages( array( 
       		'child_of' => $post->ID, 
       		'sort_column' => 'menu_order',
       		'parent' => $post->ID ) );
       	  	foreach( $mypages as $page ) {
       	  		$mycontent = $page->post_content;
       		 	$mycontent = apply_filters( 'the_content', $mycontent );
        		?>
       <!--if has children, add div in the parent section for each child otherwise no div -->
       <?php
             $childArgs = array(
                 'sort_order' => 'ASC',
                 'sort_column' => 'menu_order',
                 'child_of' => $page->ID
             );
             $childList = get_pages($childArgs);
             foreach ($childList as $child) { ?>
               <div class="grandchild-page">
               <h2><a href="<?php echo get_page_link( $child->ID ); ?>"><?php echo $child->post_title; ?></a></h2>
               </div>  
           <?php } ?><!--end grandchildren-->
       <?php } ?>
       <?php endwhile;  
          endif; ?>	
       ```
   
    -  This reply was modified 7 years, 4 months ago by [csleh](https://wordpress.org/support/users/csleh/).
      Reason: resolved
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [target grandchildren (add style?) in get_pages list](https://wordpress.org/support/topic/target-grandchildren-add-style-in-get_pages-list/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/target-grandchildren-add-style-in-get_pages-list/#post-11000428)
 * my logic is definitely wrong!
    I’ve tried another get pages with child_of post
   id in various forms, checking `if ( is_page() && $post->post_parent )` and not
   having any luck.
 * how can i test if a page from the first get_pages results has children?
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [target grandchildren (add style?) in get_pages list](https://wordpress.org/support/topic/target-grandchildren-add-style-in-get_pages-list/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/target-grandchildren-add-style-in-get_pages-list/#post-11000349)
 * I tried this, but each first level child page is showing the “i have kids” text,
   instead of just the one that actually has children
 *     ```
         <?php $mypages = get_pages( array( 
       	'child_of' => $post->ID, 
       	'sort_column' => 'menu_order',
       	'parent' => $post->ID ) );
       	  foreach( $mypages as $page ) {
       	  	$mycontent = $page->post_content;
       		 $mycontent = apply_filters( 'the_content', $mycontent );
        		?>
        <?php $args = array( 'post_parent' => get_the_ID() );
       	$children = get_children( $args );
       	if ( ! empty($children) ) {  ?>
       		<div>i have kids</div>
       	<?php } else {?>
       		<div>im lonely</div>
       	<?php } ?> 
       ```
   
 * can I not use the ID like this? If not, how can I find out if a page has children?
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [target grandchildren (add style?) in get_pages list](https://wordpress.org/support/topic/target-grandchildren-add-style-in-get_pages-list/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/target-grandchildren-add-style-in-get_pages-list/#post-11000139)
 * thanks but I don’t mean on the child page. Hopefully this will be a better explanation:
 * On a grandparent page, use get_pages to get title, etc from all descendants
    
   I’d like to style like this:
 *     ```
       <div>child 1 page</div>
       <div>child 2 page</div>
        <div class="sub-page">grandchild page of current page (child of child 2 page)</div>
       <div>child 3 page</div>
       ```
   
 * right now, all descendants get the same html in the foreach.
    Is there a way 
   to add a class depending on level? Or an if is child of a specific page (in this
   example, child page 2)? Or do get_pages for one level deep, then get_pages within
   that for child pages?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Post Type UI] want column on cpt posts listing (admin) to show custom taxonomy](https://wordpress.org/support/topic/want-column-on-cpt-posts-listing-admin-to-show-custom-taxonomy/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/want-column-on-cpt-posts-listing-admin-to-show-custom-taxonomy/#post-10711974)
 * OK, I got it! On the taxonomy edit screen, in the last group called “Settings”,
   set “Show Admin Column” to True. This will show the taxonomies for each CPT post
   on the CPT admin list screen.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [access template-parts in 2017 theme](https://wordpress.org/support/topic/access-template-parts-in-2017-theme/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/access-template-parts-in-2017-theme/#post-8804801)
 * I edit in appearance ALL THE TIME. This is the first off-the-shelf theme I’ve
   tried in a long time, and this is the first time files to edit how content is
   pulled are HIDDEN.
 * I don’t want a child theme. I don’t want FTP. I don’t want to have to open elsewhere/
   save on a development site. I’ll just replace the call with my own loop but it
   would have been easier to make one change on one file. The theme won’t be used
   for long.
 * I Can Handle It.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Table Field Add-on for ACF and SCF] add table header data elsewhere](https://wordpress.org/support/topic/add-table-header-data-elsewhere/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/add-table-header-data-elsewhere/#post-8783386)
 * So here’s what I did, this is on the single page template:
 *     ```
       <?php $table = get_field( 'table' );
       if ( $table ) {
           echo '<table border="0">';
               if ( $table['header'] ) {
                   echo '<thead>';
                       echo '<tr>';
                           foreach ( $table['header'] as $th ) {
                               echo '<th>';
                                   echo $th['c'];
                               echo '</th>';
                           }
                       echo '</tr>';
                   echo '</thead>';
               }
               echo '<tbody>';
                   foreach ( $table['body'] as $tr ) {
                       echo '<tr>';
                           foreach ( $tr as $td ) {
                               echo '<td>';
                                   echo $td['c'];
                               echo '</td>';
                           }
                       echo '</tr>';
                   }
               echo '</tbody>';
           echo '</table>'; ?>
       <script>
       var headertext = [];
       var headers = document.querySelectorAll("thead");
       var tablebody = document.querySelectorAll("tbody");
       for (var i = 0; i < headers.length; i++) {
       	headertext[i]=[];
       	for (var j = 0, headrow; headrow = headers[i].rows[0].cells[j]; j++) {
       	  var current = headrow;
       	  headertext[i].push(current.textContent.replace(/\r?\n|\r/,""));
       	  }
       } 
       for (var h = 0, tbody; tbody = tablebody[h]; h++) {
       	for (var i = 0, row; row = tbody.rows[i]; i++) {
       	  for (var j = 0, col; col = row.cells[j]; j++) {
       	    col.setAttribute("data-th", headertext[h][j]);
       	  } 
       	}
       }
       </script>
       <?php } ?>
       ```
   
 * The thead text is set as a data entry on each td, and when the table is shown
   on mobile each td shows that value directly above the content.
    I got the code
   from here: [http://codepen.io/dudleystorey/pen/Geprd](http://codepen.io/dudleystorey/pen/Geprd)
    -  This reply was modified 9 years, 3 months ago by [csleh](https://wordpress.org/support/users/csleh/).
    -  This reply was modified 9 years, 3 months ago by [csleh](https://wordpress.org/support/users/csleh/).
      Reason: credit and link to code
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Is it straighforward to implement your own hmtl and css?](https://wordpress.org/support/topic/is-it-straighforward-to-implement-your-own-hmtl-and-css/)
 *  [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/is-it-straighforward-to-implement-your-own-hmtl-and-css/#post-8727309)
 * I build html/css first, then download an underscores theme and edit the templates
   to use my html. I found the template-parts confusing at first, and copied the
   relevant codes into single.php and page.php so the code was all viewable at a
   glance.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Featherlight - A Simple jQuery Lightbox] how to have captions appear](https://wordpress.org/support/topic/how-to-have-captions-appear/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/how-to-have-captions-appear/#post-8727135)
 * silly me. On those pages the gallery is actually from custom fields, not the 
   default wordpress gallery, so I coded them myself. Got that one fixed. My other
   pages I forgot to put link to media file, not attachment page.
 * Note: to get the prev/next arrows on a gallery other than wordpress default (
   like using Advanced Custom Fields instead, for instance), a few classes need 
   to be added: _gallery_, _gallery-item_, and if you want captions to show in the
   lightbox,_ wp-caption-text_. As always, any images that link to media file are
   automatically grabbed by the plugin through the link, so no extra classes needed.
   Without the extra classes the lightbox works, just no arrows between images in
   the same gallery.
 *     ```
       <div class="gallery">   
           <figure class="gallery-item">
               <a href="...">
        	    <img src="..." alt="..." />
               </a>
        		<figcaption class="wp-caption-text">...</figcaption>
          </figure>
       </div>
       ```
   
 * Making this note to remind myself.
    Great plugin!
    -  This reply was modified 9 years, 3 months ago by [csleh](https://wordpress.org/support/users/csleh/).
    -  This reply was modified 9 years, 3 months ago by [csleh](https://wordpress.org/support/users/csleh/).
      Reason: added code sample for non-wordpress gallery to navigate through images
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Featherlight - A Simple jQuery Lightbox] how to have captions appear](https://wordpress.org/support/topic/how-to-have-captions-appear/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/how-to-have-captions-appear/#post-8670457)
 * huh. no. I started with an underscores theme and use standard wordpress install
   and updates. No modifiers in the theme functions file, so I’ll check if underscores
   does something in one of the files not called. This is a weird one.
 * Nice catch, not sure I ever would have noticed!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Featherlight - A Simple jQuery Lightbox] how to have captions appear](https://wordpress.org/support/topic/how-to-have-captions-appear/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/how-to-have-captions-appear/#post-8670184)
 * that would be great, thank you!
 * [http://dev.sullivanlehdesigns.com/work/trafficsafety-org-website/](http://dev.sullivanlehdesigns.com/work/trafficsafety-org-website/)
 * not the large first image in a circle, scroll a bit to the others that have captions
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Post Type UI] doesn’t show to add to nav menu](https://wordpress.org/support/topic/doesnt-show-to-add-to-nav-menu/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/doesnt-show-to-add-to-nav-menu/#post-8445337)
 * never mind, I got it.
 * Not only did I have to check the “screen options” on the top of the screen, but
   under the custom post type drop down, only the posts showed by default. Simply
   use the “view all” tab to show the archive page to add to the menu.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GatherContent Plugin] advanced custom fields?](https://wordpress.org/support/topic/advanced-custom-fields-13/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/advanced-custom-fields-13/#post-8436987)
 * it worked for basic stuff but doesn’t map to flexible layout rows. (also confusing
   because the flexible rows were shown twice in the dropdown, the second time with
   and underscore in front. i tried both). bummer.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[GatherContent Plugin] advanced custom fields?](https://wordpress.org/support/topic/advanced-custom-fields-13/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/advanced-custom-fields-13/#post-8434820)
 * thank you. It’s weird because the other day I could choose “custom fields” but
   the next section didn’t have my fields. I wonder if one page had to be published
   first or if the archive template had to exist or something. But it’s there now
   and I’m so grateful!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Easy PayPal Events & Tickets] error when trying to create event](https://wordpress.org/support/topic/error-when-trying-to-create-event/)
 *  Thread Starter [csleh](https://wordpress.org/support/users/csleh/)
 * (@csleh)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/error-when-trying-to-create-event/#post-8263990)
 * With the error code edited out a new form can be created, but a form cannot be
   edited. no orders are tracked, and even though the test email sends no other 
   email is sent. it seems to send to paypal correctly, but doesn’t return to the
   correct page.

Viewing 15 replies - 1 through 15 (of 288 total)

1 [2](https://wordpress.org/support/users/csleh/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/csleh/replies/page/3/?output_format=md) …
[18](https://wordpress.org/support/users/csleh/replies/page/18/?output_format=md)
[19](https://wordpress.org/support/users/csleh/replies/page/19/?output_format=md)
[20](https://wordpress.org/support/users/csleh/replies/page/20/?output_format=md)
[→](https://wordpress.org/support/users/csleh/replies/page/2/?output_format=md)