• Resolved pedrovalentim

    (@pedrovalentim)


    Hello,
    I’m using ACF Pro and I created a relationship field where I make poll relationships created on the post.

    I’m trying to access fields like images and options for each poll through wp_query.

    I would like to create my own template.

    Kind regards!

    $args = array(  
    				'post_type' => 'onyxpolls',
    				'posts_per_page' => 2, 
    				'orderby' => 'title', 
    				'post__in' => $idEnquetes,
    				'order' => 'ASC', 
    			);
    			$loop = new WP_Query( $args ); 
    
    			while ( $loop->have_posts() ) : $loop->the_post(); 
    				get_field(); <-- get fields images and options from poll
    			endwhile;
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author andremacola

    (@andremacola)

    Well, I do not recommend using this way to create a template, especially if you use any caching solution.

    The plugin has several optimizations to handle with caching, cookies etc …

    If customize the CSS with CSS Variables, change the style (twitter or standard) or totally disable the plugin CSS inside options page is not what you required then using the Onyx Poll REST endpoints is the best way to create a custom template solution.

    
    // parameters to vote
    {
      "poll": 85,
      "choice": 2
    }
    

    With that said, the fields are:

    
    'onyx_poll_answers'
      'image'
      'answer'
      'votes'
    'onyx_poll_limit_vote'
    'onyx_poll_results'
    'onyx_poll_end'
    'onyx_poll_total'
    'onyx_poll_images'
    'onyx_poll_modal'
    'onyx_poll_show_results'
    'onyx_poll_expired'
    'onyx_poll_modal_time'
    'onyx_poll_css'
    'onyx_poll_block_id'
    'onyx_poll_block_style'
    
    • This reply was modified 4 years, 4 months ago by andremacola.
    • This reply was modified 4 years, 4 months ago by andremacola.
    • This reply was modified 4 years, 4 months ago by andremacola.
    Thread Starter pedrovalentim

    (@pedrovalentim)

    Thanks a lot!
    kind regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get fields from poll’ is closed to new replies.