Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Ah okay..

    well I’m not unfamiliar to that approach to be honest since I’ve been in the same seat.. Altho you know you could add the custom content to the terms edit pages in admin and display them in the wp archive. But I guess that’s not too user friendly and especially if you have a lot of info to be put in.

    It’s a good idea to name the custom field differently than the taxonomy since it can cause issues.. so thats good!

    May I ask then how the user selects which terms the post should be connected to? Are you using acf taxonomy field?

  • @Jonathan Thanks for the detailed response! I do know about WP’s built-in archive functionality, so I should have mentioned that I want my client to be able to edit content on these pages. That’s why I’m taking the page template approach.

    I also should have been clearer in my description above, and said that my custom field is also named “q_and_a_category”. Hence this:

    ‘key’ => ‘q_and_a_category’

    For clarity (and to avoid any potential conflicts) I have changed the custom field name to “q_and_a_category_select”.

    I tried following your advice of changing meta-query to tax-query, and applying what I read here: http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

    I couldn’t get that to display any posts either, and it seems like it would also remove the acf functionality that I’m looking for in the first place…specifically, the ability for my client to manually select which category of post is being displayed on the page.

    Sorry if I’m not understanding you and/or not being clear myself. Looking forward to any additional thoughts, thanks!

  • hi @Jonathan,

    Yes, it’s a development site so I’m not worried, just making sure @elliot was aware which I am sure he is.

    “rofl” is a good quick search in source, unless of course that is commonly used in your framework 😉

    Thanks.

    Slightly off-topic, but as I’m continuing to work, what about a ‘html_validation_error_msg’ field as well? Or is there a filter I can use for that? I’d like to make the validation error message a little more friendly since it’s a front-end form.

  • Hi!

    What you’re trying to do actually already exists in WP. Since you’ve created a custom post type with a custom taxonomy there’s an archive (provided that you have set archive to true when creating the post type). So you should be able to reach each taxonomys posts by having an url something like this:

    http://www.myurl.com/q_and_a_category/design

    Wordpress will use archive.php per default to display these but if you require customization and dont want to affect the regular archives you can create a new template:

    taxonomy-q_and_a_category.php

    If you want specific templates for the terms you can do:

    taxonomy-q_and_a_category-design.php

    etc.

    If you still want to do it in the way you’ve done so far (i would not recommend it) you need to replace the meta-query with a tax-query since the taxonomys terms are not meta values..

    Read more here: http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

  • Hi Synergy..

    First of, codoes on using rofl as a way of debugging.. gotta remember that ;9

    I can’t help you with most of this but I do think that your jquery error is due to the latest jquery. in the next version of ACF it says on the do to:

    JS: Major update to conditional logic JS to allow for repeater sub fields – will also require an update to the repeater field add-on

    So I think Elliot will have that fixed by then. In the meantime if it really screws with you it wouldn’t be the end to revert back to 1.8.2 (i think thats the last one). I’ve had to do it myself on some occasions..

  • Hi @rdck

    Sorry, I don’t quite understand what you mean by it would only bring back one repeater… not all?

    Can you explain the issue with more clarity? What are you expecting and what do you get instead?

    Thanks
    E

  • Cheers for the quick reply!

    I tried that but unfortunately it didn’t work… for now i’ve ended up just commenting out the filter from wysiwyg.php.

    the field i’m using is a sub / repeater field so maybe thats why?

    This is what I tried:

    echo get_sub_field('content', $post_id = false, $format = false);

  • Thanks Eric – a filter would be great!

    BTW, I love your plugin! I’ve used it to replace Custom Press on several websites, because CP requires an annual membership to WPMU Dev (which is expensive) to get updates.

    The only thing that would make ACF a *perfect* replacement would be for it to allow users to easily create a Custom Post Type as well – I did manage to do that via my functions.php file after some research on how to do it, but that could be daunting to most WP users. Maybe this is something you could consider also adding to a future update of ACF?

  • Hi @Elliot,

    Many thanks, I now have this working.

    Just a quick question:

    What is the likely hood of this functionality breaking on a future update of ACF or WordPress if the developer doesn’t update his ‘post template’ plugin?

    I really don’t want my clients site breaking on future updates. So I’m just wondering how safe it is to implement this sort of thing?

    Many thanks
    Stuart

  • On further investigation, this issue does NOT have to do with the Theme My Login plugin.

    My code for the template is below. Could there be something wrong with it?

    <?php
    /**
     * Template Name: Profile Downloads
     * ==============================================
     * This template is responsible for managing the
     * each user's downloads.  Let's see how this goes
     *
     * @author		carvache
     * @date		8/30/2014
     */
    
    // Preprocessing Logic
    if ( !is_user_logged_in() )
    	exit('You must login to see this page');
    
    acf_form_head();
    
    get_header();
    	?>
    	<div class="content-wrapper">
    		<div class="page-wrapper">
    			<div class="gdl-page-float-left">
    				<div class="gdl-page-item">
    					<div class="sixteen columns mt 30">
    						<h1 class="gdl-page-title gdl-divider gdl-title title-color"><?php the_title() ?></h1>
    						<?php
    
    						acf_form(array(
    							'post_id' => 'user_' . get_current_user_id(),
    							'field_groups' => array(600), // the ID of the field group
    							'updated_message' => '', // default updated message. Can be false to show no message
    							'form' => true
    						));
    
    						?>
    					</div>	
    				</div>
    			</div>
    		</div>
    	</div>
    	<?php
    get_footer();
  • Quick question — why would this return each repeater on the page; but if I query the page from another template, for example

    <?php $animal_health = new WP_Query('post_type=page&p=126'); while ( $animal_health->have_posts() ) : $animal_health->the_post(); ?>

    it would only bring back one repeater… not all?

  • Thanks for the quick response. It occurs when I go into the Media Library and add then edit a new image or edit an existing one. The edit page comes us correctly initially, with the custom fields, but clicking any of the checkboxes causes it to reload and lose the custom fields. I have the fields divided into three tabs, if that makes any difference. Like TimTee above, I’ve switched to a multi-select field as a stopgap, and that works but it’s not as good.
    There’s no POPUPs involved, as far as I can see, but I may not be understanding your question.
    Thanks, Peter

  • Hi!

    Well, it shouldn’t be listed as a “list” as in

      or

        .. I want it listed in one line without touching the css so I coded it that way.. Also, there is a possibility that not all the Doctors will have a “Sub Specialty” that’s why there’s this line of code:

        <?php 
        if (get_field('sub_specialty') != '') { ?>

        I removed the array($terms); too. =]

        Here’s my final code on displaying the term name:

        <?php
            $terms = get_field('sub_specialty');
            foreach ($terms as $term){
                $subspec[] = '<a href="'.$term->slug.'" name="'.$term->slug.'" alt="'.$term->anem.'">'. $term->name .'</a>';
             }
            echo implode(' / ', $subspec);
        ?>
      1. Hi! Okay well I don’t know how your code looked before that was just to show you how to retrieve the name rather than just the id 🙂

        Your code seems a bit excessive and unsemantic. Is there any reason it couldn’t look like this?

        
        
        <?php if (get_field('sub_specialty')) { //Sub speciality ?>
        	<strong>Sub specialty.:</strong>
        	<ul>
        	<?php $terms = get_field('sub_specialty'); ?>
        	<?php foreach ($terms as $term){ ?>
        			<li><a href="<?php echo $term->slug; ?>" name="<?php $term->slug; ?>" alt="<?php $term->name; ?>"><?php echo $term->name; ?></a></li>
        	<?php } ?>
        	</ul>
        <?php } ?>
        

        There’s no unnecessary functions running, the else-statement was removed, the if statement is changed to be simpler, name was corrected and the html is semantically correct since it’s now an unordered list instead of links with an inline break. 🙂

        Happy coding

      2. God.. these forum’s wysiwysg is buggy. When you you try to add link to a string, it closes window! I wrote a long descripton but its gone because of that -.-‘

        Anyway..

        It was for map markers. I want users add multi markers if they want. In future, i will try to support advanced additions like interactive map: http://leafletjs.com/examples/choropleth.html or vectors maybe: http://leafletjs.com/examples/quick-start.html Thats why i have to use flexible content for markers but it has to be 1 option for now.

      3. Hi Jonathan!

        I switched the return value to Term Object as your reco but the code did not work. Anyways, I fixed it already and here’s my working code:

        <?php 
        						/* sub specialty */
        						if (get_field('sub_specialty') != '') { ?>
        						<strong>Sub specialty.:</strong>
        						<?php
        $terms = get_field('sub_specialty');
        array($terms);
        foreach ($terms as $term){
        $subspec[] = '<a href="'.$term->slug.'" name="'.$term->slug.'" alt="'.$term->anem.'">'. $term->name .'</a>';
        }
        echo implode(' / ', $subspec);
        ; ?>
        						<br />
        						<?php } else { ?>
        						
        						<?php } ?>

        I added some codes too according to how I want it to be displayed.

        Thanks for replying btw. =]

        God bless!! ;]

      4. Hi Elliot,

        I have checked all of our sites which are up to date with WP and your plugin and they all have the issue. Sorry to be the bearer of that news.

        After installing developer tools and running as an iPad (user agent only) the following information was revealed. I only have windows machines and to run the device as itself via my machine requires Safari 6 which you cannot get on Windows.

        http://www.drsolutions.co.uk/before-click.png
        http://www.drsolutions.co.uk/after-click.png (the native app option takes you to WordPress for iOS app, after testing this does not load acf fields)

        So as a summary, the main add media button on the generic page allows access to the media window to take or pick a picture. The single acf image field also allows access to the media window. Only when trying to use the image field in the repeater its doesn’t trigger.

        Sorry I cannot debug any further… Very frustrating.

        Travis

      5. Hi @quincypabotoy

        Thanks for the info. Yes, your code is pointing to the wrong path.
        Just remove the initial / to make the path relative instead of absolute

      6. Hi @modifly

        I appreciate your enthusiasm to get this working, however, I don’t have the time to pick up the phone and chat / work on this issue.

        Your dev will find all the ACF JS in the ACF github repo. If you have nay specific questions about the code, please feel free to ask them, but I can offer my time to help out on everyone’s projects.

        Thanks for understanding
        E

      7. Hi @davelee

        Yes, with the newly coming sub field conditional logic, your screenshot will work as expected.

        For now, you will need to write some custom JS.

        Do you need any help with the jQuery?
        Have you got an event firing when you change the select field (which determines the number of columns?)

      8. Hi Jonathan,

        Yes the code is in banners.php which I’ve included in both single.php and single-company.php, thus I don’t see how come it doesn’t work on single-company.php but only on single.php 🙁

        If it please you here is the code in its entirety on banner.php:

        <?php if ( is_single() || is_singular() ) : // for singular items only ?>
        
        	<?php while ( have_posts() ) : the_post(); ?>
        
        		<?php $post_objects = get_field('banner_selection');?>
        		<?php if( $post_objects ):  // if banner selection was made, show those ?>
        			<?php foreach( $post_objects as $post): ?>
        				<?php setup_postdata($post); ?>
        				<?php get_template_part( 'banner','side' ); ?>
        			<?php endforeach; ?>
        			<?php wp_reset_postdata(); ?>
        
        		<?php else: // if there are no selected banners, show random 5 banners ?>
        			<?php query_posts( array ( 'post_type' => 'banner', 'meta_key' => 'banner_type', 'meta_value' => 'sidebar', 'posts_per_page' => 5, 'orderby' => 'rand' ) ); // The Query ?>
        				<?php while ( have_posts() ) : the_post(); // The Loop ?>
        					<?php get_template_part( 'banner','side' ); ?>
        				<?php endwhile; ?>
        			<?php wp_reset_query(); // End Query, RESET ?>
        		<?php endif; // end if banner selection was made ?>
        
        	<?php endwhile; ?>
        
        <?php else : // for homepage/archive items only ?>
        
        	<?php query_posts( array ( 'post_type' => 'banner', 'meta_key' => 'banner_type', 'meta_value' => 'sidebar', 'posts_per_page' => 5, 'orderby' => 'rand' ) ); // The Query ?>
        		<?php while ( have_posts() ) : the_post(); // The Loop ?>
        				<?php get_template_part( 'banner','side' ); ?>
        		<?php endwhile; ?>
        	<?php wp_reset_query(); // End Query, RESET ?>
        
        <?php endif; // is_single() ?>

        On your second point though, the code is outside the loop. This *could* be the case, however I still have no idea why it wouldnt work for single-company.php when it works for single.php.

        Many thanks in advance!

      9. Thanks! I’ve ended up using this in order to still have a fallback image using Get The Image:

        			<?php 	$attachment_id = get_field('product_image');
        				$size = "thumbnail";
        				$image = wp_get_attachment_image_src( $attachment_id, $size ); 	
        				if ( $image != 0 ) { ?>
        				<img src="<?php echo $image[0]; ?>" />
        				
        			<?php 	} else {
        				get_the_image( array( 'size' => 'thumbnail', 'default_image' => get_stylesheet_directory_uri() . '/images/placeholder.jpg' ) );
        			} ?>
      10. I need a temporary solution, even a dirty one. I handled when option is changed with this:

        (function($) {
        	$(document).on("change", "[data-field_name=collection_type]", function(){
        		$checked = $(this).find("input:checked");
        		console.log($checked.val());
        	 });
        })(jQuery);

        I couldnt catch if data is already saved and window loaded. Any suggestion if possible?

      11. Thanks alot Jonathan, I’m having an problem displaying the image with your code, its returning <img src="Array" />?

        Thanks for your help again, I’m still learning 🙂

      12. Alrightie then.. your code is extremely overdoing it!

        You’ll want something like this:

        
        <?php
        
        $args = array( 'hide_empty' => '0');
        $categories = get_categories($args);
        if($categories){
        	echo '<ul>';
        	foreach($categories as $category) {
        		echo '<li>';
        		$image = get_field('nameofimagefield', 'category_'.$category->term_id);
        		echo '<img src="' . $image . ' />'; //change depending on the return value of the image field
        		echo '<span class="cat-title">' . $category->name . '</span>';
        		echo '<span class="cat-subtitle">' . get_field('nameofsubtitlefield', 'category_'.$category->term_id) . '</span>';
        		echo '<span class="cat-description">' . $category->description . '</span>';
        		echo '</li>';
        	} 
        	echo '</ul>';
        }    
        
        ?>
        

        dont forget to change the fieldnames

      Viewing 25 results - 20,676 through 20,700 (of 21,339 total)