Jump to content

SarbjitGrewal

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by SarbjitGrewal

  1. On 8/22/2017 at 12:45 PM, kuba2 said:

    Hello

    Quite a basic question from me:

    I am wondering what's the best approach to code cards like in the example image. What is the most elegant and efficient way to make these.

    Thanks for any suggestions.

    Jakob

     

    599bd7f45105d_Bildschirmfoto2017-08-22um09_02_12.png.30eac9e8e53bded1b9f1b9e2ae8ef471.png

    If you can implement images directly that would be better than coding for each image. 

  2. I have included a repeater on my page (well, four to be exact) but I am having an issue on how to loop through the Repeater in the code behind to retrieve the value of a text box in each row....

     

    <?php
    add_action( 'genesis_entry_content', 'your_plugin_slug_repeater_loop' );
    /**
     * your_plugin_slug_repeater_loop function.
     * 
     * @access public
     * @return void
     */
     
    function your_plugin_slug_repeater_loop() {
    	$rows = get_field( '_your_repeater_field' );  //this is the ACF instruction to get everything in the repeater field
    	$i = 0;  //this is a variable which sets up the counter starting at 0
    	if($rows) {
    		echo '<ul class="your-class-list">';
    			
    		foreach($rows as $row) {	
    			$i++; //this says keep counting
    			
    			if( $i % 3 == 1) { // this says, if the item number is divisible by 3 then
    				$class = '&nbsp;first' ;  // add this class
    				$i = 1;  // then reset the counter back to 1
    			}
    			else 
    				$class = ''; //otherwise don't output anything
    				
    				echo '<li class="repeater-item one-third' .  $class .'"><span class="repeater-title">' . $row['name_of_repeater']. '</span><a title="'. $row['name_of_repeater'] . '" href="' . $row['link_to_repeater'] .'"><img class="" src="' . $row['item_repeater'] .'" /></a><a href="' . $row['link_to_repeater'] .'" class="button">Download PDF&nbsp('.  $row['pdf_size'] . ')</a></li>';
    			}
    			
    		echo '</ul>';
    	}
    }

     

×
×
  • Create New...