Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • There’s nothing within ACF to allow such functionality. However, you could link to the files within password protected pages. No additional plugins required. This doesn’t secure the files directly, as anyone who knows the URL to the file will have access.

  • Glad I could help jrstaatsiii.

    As requested, here are some before and after images. These where taken from a 1280×900 screen. Even with the nested repeaters there should be plenty of room for the UI.

    Before: Nested repeaters version 1.0.1 and prior…

    Nested repeaters vr. 1.0.1

    After: Nested repeaters version 1.1.0…

    Nested Repeater fields after 1.1.0 update

  • Ah sorry, I meant the acf “add-ons” which I put in a folder thus named:

    include_once('add-ons/acf-repeater/acf-repeater.php');
    include_once('add-ons/acf-gallery/acf-gallery.php');

    Thanks.

  • Hi – thanks for getting back to me.

    Found the original issue, it was a ; instead of a :

    But anyway, went back to docs and this is what I am now using.

    <?php 
     
    	// vars
    	$queried_object = get_queried_object(); 
    	$taxonomy = $queried_object->taxonomy;
    	$term_id = $queried_object->term_id;  
    	 
    	// load content for this taxonomy term
    	$docs = get_field('docs', $taxonomy . '_' . $term_id);
    	var_dump($docs);
     
    ?>
    	
    	
    <?php if($docs = get_field('docs')): ?>
     
    	<?php while($docs = has_sub_field('docs')): ?>
     
    		<p><?php the_sub_field('doc_title'); echo $docs; ?><br>
    		<?php the_sub_field('doc_file'); ?></p>
     
    	<?php endwhile; ?>
     
    <?php endif; ?>

    This works, as in, when using var_dump I can see the output. But it’s only the string.

    Can’t seem to get it to display in the repeater code.

    Any ideas?

    Thanks,
    Matt

    //EDIT – The repeater group is called docs. The sub fields are doc_title and doc_file

  • Hi and Thanks for answering and for your time!
    To simplify a little:

    “note: you don’t need to specify the $post_id for any sub field functions”

    This is in your documentation, for the new version of ACF. We think this change is the problem.

    When we rolled back ACF one step, everything works again.

    The structure example posted before, is not a real function, just a ‘dummie’. Our setup is very complex and hard to explain. But I try:

    EVERY POST have the exact same ACF setup fields:

    The Repeater has a subfield with a Flexible content with layouts, and in one layout a relationship post object field.

    This is what we accomplish:

    Every post and page has the same Repeater. With this we build the content below the standard editor. And a post can include another post(s) repeater-content, and that post can include repeater-content from another post… No depth limit, but a post id can never be include itself in each chain.

    We are not using widets. We are using posts. Example: One post using ACF Gallery and location field (in the repeater). We wanna re-use this post as a widget.

    Example: The main query POST “Delayed travels” says (in the repeater):

    Include POST Gallery on Sidebar 2 on top, and
    Include POST Airport Links on Sidebar 3 …

    Then the latter POST Airport Links, says: (in its own repeater field)

    Include POST Airport Germany links on Below main content
    Include POST Airport Sweden links on Below main content
    Include POST Airport Sydney links on Below main content
    Include POST Airport New Zeeland links on Below main content

    This is done with a simple output strategy. The Main post ( the page ) is using the wp single.php template, and the loop. Thats where the reading of the ACF fields starts. But it passes the post ID to a FIRST function with its own scope. Every post object called from here are NOT using any templates for output the html. Its done in a second function who echoes out its HTML. If this has repeater content, this posts id are passing up to the FIRST function. Its standard script function pass to unique scope.

    The key is to pass the ID to the FIRST function that holds “while has subfield”, and all the stuff to see if any post objects are gonna be included after rendering its own content.

    This scope is not unique anymore, couse ACF starting to use sub fields from the loop (where it all begins). WE THINK…

    Here is the REAL PHP the beginning of the 2 main functions and the loop.

    
    //MAIN LOOP
    the_content();
    $extra_content = get_field('activate_content_below', get_the_ID());
    if($extra_content) whatever(get_the_ID()); 
    // END MAIN LOOP
    
    This is in functions.php
    // unique scope :
    function whatever($id){
    	while(has_sub_field('ua_acm_rf_master', $id)){
    		if(get_sub_field('ua_acm_rf_activate')){ // true or false switch
    			while(has_sub_field('ua_acm_rf_fc_master', $id)){
    				if(get_row_layout() == 'ua_acm_rf_fc_post_include'){ 
    					if(get_sub_field('posts')){
    						foreach(get_sub_field('posts') as $p){
    							$inc_id = $p->ID;
    							ua_post_this($inc_id); <-- REMARK NEW ID
    
    							
    // unique scope :							
    function ua_post_this($inc_id){
    	$obj = get_post( $inc_id );
    	echo '<h1>'.$obj->post_title ... and so on
    	
    	Now, we check if THIS post have som ACF field, calling the SAME function as the LOOP did.
    	$extra_content = get_post_meta($inc_id, 'activate_content_below', true); 
    	if($extra_content) whatever($inc_id); <-- RE-USING FIRST FUNCTION
    }
    

    Im shure its a small, tiny change like global $something that destroys this setup. But the worrying part is that we are completley building with ACF, and it is a Huge invested time in this modular building setup. We must get it to work and keep up with latest versions…

    Many many thanks for looking in to this.

  • Ah!You are right!

    Excuse me 🙂

  • Nailed it. Thanks.

    A mixture of WordPress Class $wpdb (http://codex.wordpress.org/Class_Reference/wpdb) and your functions.

    Saved me (for the moment) from having to write a Save to Database function using WordPress. Also means I can keep my Custom Admin Fields all together in ACF, a bit neater that way.

    RoyalSlider places its data in a table called wp_new_royalsliders (obviously table prefix will be custom to each developers WordPress tables).

    add_filter('acf/load_field/name=media_gallery_slider', 'my_acf_royalslider_choices'); 
    
    function my_acf_royalslider_choices($field){
    
      $field['choices'] = array();
    
      // Required to make use of the wpdb Class
      global $wpdb;
    
      // Query the database
    
      $query = $wpdb->prepare('SELECT * FROM %1$s ORDER BY ID ASC', 'wp_new_royalsliders');
      $results = $wpdb->get_results($query);
    
      // Check for $results
      if(!empty($results)) :
    
      foreach($results as $result) :
    
          $value = $result->id;
          $label = $result->name;
    
          $field['choices'][ $value ] = $label; 
    
      endforeach;
      endif;
      return $field;
    }
    
  • Sorry, thought I used the code button. I use the file object setting as the return field.

    if(get_field('pdf_download_repeater'))
    {
    	echo '<div class="widget"><h3 class="widgettitle">Downloads</h3><ul>';
    						
    while(has_sub_field('pdf_download_repeater'))
     {
     $attachment_id = get_sub_field('pdf_download_repeater');
     $url = wp_get_attachment_url( $attachment_id );
     $title = get_the_title( $attachment_id );
    							
     echo '<li><a target="_blank" class="download_pdf" href="' . $url . '">' . $title . '</a></li>';
     }
    					 
     echo '</ul></div>';
    }

    I’ll try the debugging right now

  • Thanks for the swift reply, Elliot.

    The basis of my repeater code is essentially:

    <?php if(get_field('featured_listing')) : ?>
    <?php while(has_sub_field('featured_listing')): ?>
    <div class="promo">
      <h3><a href="<?php the_sub_field('featured_url'); ?>" target="_blank"><?php the_sub_field('featured_name'); ?></a></h3>
      <div class="button"><a href="<?php the_sub_field('featured_url'); ?>">Visit website</a></div>
    </div>
    <?php endwhile; else: ?>
    <div class="promo empty">
      <p>Nothing to see here, why not <a href="#">add a promo</a>?</p>
    </div>
    <?php endif; ?>

    I appreciate this is probably all completely wrong! 🙂

    Thanks again,

    Paul

  • Hi, you can use advanced tinymce plugin to do this.

    But the question is:

    Do you already know how to build own buttons in custom tinymce editor (different than the default one)?

  • Thanks Elliot. That’s the plan over time. I was hoping to come up with a mild work-around to help teach me this as a good learning project. The reviews already use ACF with a custom field that contains a numeric for every film (fractional as each film can have half-stars). That I had no problem with.

    We do edit the sidebar almost every day to add the entries manually.

    The complexity in a full widget app is “x amount of movies” is a moving target. Summer makes for a longer list. Some films hang around MUCH longer than others and need a way to be held over so it can’t simply be a case of showing 10 films in the list or showing from one date to another.

    As I said, I did manage to get the custom field working fine (that’s what’s feeding the actual review posts) and I managed to write my first Shortcode to display stars based on manual entries so I’m getting there.

    The wall I hit was in not having any clue how to go the next step and you’re suggesting it’s a BIG one. We may need to pay someone but right now that’s just not in the budget.

  • Thanks for the update Elliot. This has also caused issues with several sites running on a theme that requires ACF:

    if(is_plugin_active('advanced-custom-fields/acf.php') == true && function_exists('get_field')) {
    
        include('myfile.php');
    
    }

    Looking forward to the new version soon! :]

  • Hi @ptron

    A quick Google uncovered a github with the compatibility you are after:
    https://github.com/lukechapman/custom-post-template-support-for-acf/blob/master/acf-custom-post-template-support.php

    Thanks
    E

  • Hi @ksy

    Thanks for the feature request.

    Can you give an example of the rule in english?

    Thanks
    E

  • Hi @spacewindow

    This functionality is not part of the ACF plugin. Where is the RoyalSlider data stored? In custom tables in the DB?

    You could use a basic select field, but then hook into the load_field filter, run some custom SQL to find your custom choices, and then update the select field with these values.

    Tutorial: http://www.advancedcustomfields.com/resources/tutorials/dynamically-populate-a-select-fields-choices/

    Thanks
    E

  • Hi @Intervik

    Thanks for the post, but I’m quite confused as to what the issue actually is.

    You mention at the start that this statement is a raise for concern:
    “note: you don’t need to specify the $post_id for any sub field functions”

    Where is this statement found, I cant find it…

    When looping through a nested has_sub_field function, the $post_id is never needed because it is loading data from the already setup previous loop.

    Is this the issue?:
    while(has_sub_field('FLEXIBLE_CONTENT_ROOT', $id)){ <-- FAILS SECOND CALL to my_output_html($id)

    What is FLEXIBLE_CONTENT_ROOT? Why is ROOT in it’s name. Is this within a repeater or outside a repeater?

    You mention that it fails to call my_output_html. But there is no code which runs this in the nested loop…

    Also, why do you say:
    “CORE: The repeater includes a flexible content setup, and now, somwhere in the chain the global $post ID is re-used.”

    I guess there is a lot of information to tell, but please do in a clear and flowing way. The above is more of a mental dump which is very hard to understand what the exact issue is.

    Thanks
    E

  • Hi guys

    Can you confirm there is no syntax issues in teh exported code. 4.3.0 introduced a __() wrap around labels and instructions. This has caused some issues with strings that contain quote marks and has been removed.

    Perhaps this could lead to a solution?

    Thanks
    E

  • Hi @Soulstudio

    This is no bug. The result is exactly what you have coded. If you wish to create any MARKUP, you need to code this youself. eg:

    
    <?php 
    
    // Adds “Status” field to posts
    function add_status_field() {
    	
    	?><p class="class-here"><?php the_field('status'); ?></p><?php
    	
    }
    add_action('thematic_abovepost', 'add_status_field');
    
     ?>
    
  • Hi @gleenk

    Good solution. I’ll consider adding it in, but I’m sure for now you could code up the jQuery in an hour or so.

    Thanks mate
    E

  • Hi @daansmit

    I think you may have the wrong thread. This thread is for the “add row” label, not for any issues regarding removing a layout.

    Thanks
    E

  • Hi @rsrc1147

    Thanks for the feedback. Perhaps because the query_posts function is run as an AJAX call, the switch blogs function doesnt work?

    Can you google around for any help regarding AJAX functions and switching blogs?

    Thanks
    E

  • Hi @mantismamita

    Sorry, I don’t understand what you mean by the ‘add-ons’ folder. Can you shine some light on this?

    Thanks
    E

  • Hi @Phillip

    It is hard for me to guess which is missing and which isn’t
    Can you please provide very clear instructions as to what exactly has changed?

    What do you mean by:
    “but several have disappeared entirely from the ACF editor”

    Also, what do you mean by:
    “and are not in the “add repeater” section:”

    I removed your mysql data from this post for security reasons, so I can’t access your DB data. Perhaps you could look at the postmeta table and take a screenshot of all the postmeta data for the home page ID?

    Thanks
    E

  • Hi @davelee

    Within the loop of $rows, you could find out the status of the post like so:

    
    <?php 
    
    // loop through the results
    if( $rows )
    {
    	foreach( $rows as $row )
    	{
    		if( get_post_status($row->post_id) != 'publish' )
    		{
    			continue;
    		}
    		
    		// run code here
    
    	}
    }
    
    ?>
    

    Hope that helps.

    Thanks
    E

  • Hi @Agrajag

    The better way is to create this data dynamically. Are you manually editing this sidebar content each time a new movie comes out?

    The smart approach would be to code a PHP driven widget that loops through the latest x amount of movies and then (using a radio button field on each movie), use the movie’s rating to render out the amount of stars.

    I would create a custom field on each movie to select 1,2,3,4 or 5 as a value.

    Then you will need to re-code your sidebar to loop through the movies using a get_posts function.

    Since you are new to to WP and PHP, I doubt you will be comfortable coding this yourself. I would recommend that you contact a freelance to write this code for you as the ACF plugin unfortunately requires you to have solid WP and PHP skills.

    Thanks
    E

Viewing 25 results - 19,876 through 19,900 (of 21,394 total)