Support

Account

Forum Replies Created

  • Hi James, I got it working with the GET variable.

    Here is my data.php code.

    <?php
        require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');
        $post_ID = $_GET['id'];
    
        $custom = get_post_custom($post_ID);
    
        foreach ($custom as $key => $value) {
            if (($key != '_edit_lock' && $key != '_edit_last'))
                echo '<tr><td>' . $key . '</td><td>' . $value[0] . '</td></tr>';
        }
    ?>

    Can you please explain me a little more that how can i add single custom field using the_field after closing php tags like that

    <?php
        require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');
        $post_ID = $_GET['id'];
    
        $custom = get_post_custom($post_ID);
    
        foreach ($custom as $key => $value) {
            if (($key != '_edit_lock' && $key != '_edit_last'))
                echo '<tr><td>' . $key . '</td><td>' . $value[0] . '</td></tr>';
        }
    ?>
                        <span class="aps-1co"> <?php the_field('device_type'); ?> </span>
                        <span class="aps-1co"> <?php the_field('data1'); ?> </span>
    

    Do i need a closing php tags again? because the_field is not working and the upper php section is working.

  • I tried but still unable to get the desired results. This is very advanced for me especially jquery.

  • This reply has been marked as private.
  • Hi @james, There is not a plugin but copied from a tutorial. Tabs are working via AJAX.

    Thanks

  • Hi @james, It’s working now. Thanks a lot for making it work. The last issue how to pass the post id using variable in the tab url

    I tried this but not working.

              <li><a href="<?php echo get_stylesheet_directory_uri(); ?>/includes/tabs/data.php?postid=<?php echo $post->ID ?>" class="tab">Data</a></li>
    

    Any idea how can i achieve this.

  • Hi @james, This is also not working. May be i am doing something wrong. This code is working inside a tab. Please have a look. This is for showing posts..

    <?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    require_once('../../../../../wp-load.php');
    // Show Posts
    $args = array(
    	'post_type'      => 'post',
    	'posts_per_page' => '6',
    );
    $post_type = new WP_Query( $args );
    if ( $post_type->have_posts() ) {
    	?>
    	<h2>Posts using WP_Query</h2>
    	<?php
    	while ( $post_type->have_posts() ) : $post_type->the_post();
    	?>
    		<article style="padding:0;" class="post type-post entry" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
    			<header class="entry-header">
    	                	<a style="display:block;margin-bottom:10px;" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    	                		<?php if ( has_post_thumbnail() ) { the_post_thumbnail('large'); } ?>
    	                	</a>
    	                	<h2 class="entry-title" itemprop="headline"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    			        	<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    						<?php the_title(); ?>
    					</a>
    				</h2>
    			</header>
    			<div class="entry-content" itemprop="text">
    				<?php the_excerpt(); ?>
    				<a class="more-link" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">[Read more...]</a>
    			</div>
    	        </article>
    	<?php
    	endwhile;
    } // if
    wp_reset_postdata();

    I don’t know how to modify this code to fit my group data inside it. Can you please give me an example. Thanks

  • James, The Tab is working using Ajax. Here is my page template that is set for tabs.

    <?php
    Template Name: Single Post with data
    */
    //* Enqueue tab js including jQuery UI Tabs
    add_action( 'wp_enqueue_scripts', 'my_load_tab_script' );
    function my_load_tab_script() {
    	wp_enqueue_script( 'my-tabs', get_stylesheet_directory_uri() . '/assets/js/my-tabs-ajax.js', array( 'jquery-ui-tabs' ), '1.0.0', true );
    }
    //* Remove the post content and add our tabbed content
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
    add_action( 'genesis_entry_content', 'my_do_tabbed_content' );
    function my_do_tabbed_content() {
    ?>
    	<div id="tab-wrap">
    
    		<!-- Tab links -->
    		<ul class="tabs">
    			<li><a href="#tab_1">Overview</a></li>
    			<li><a href="<?php echo get_stylesheet_directory_uri(); ?>/includes/tabs/data.php" class="tab">HTML</a></li>
    		</ul>
    
    		<div class="my-tab-content">
    			<!-- Tab content - id must match the href from the tab link -->
    			<div id="tab_1">
    				<?php the_content(); ?>
    			</div>
    
    		</div>
    
    	</div>
    <?php
    }
    //* Run the Genesis loop
    genesis();

    and here is my data tab file data.php

    <?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    require_once('../../../../../wp-load.php');
    
     $group_ID = 12113;
     $fields = get_fields($groupID);
    
     $fields = get_field_objects();
    echo '<div class="aps-column">';
    echo '<div class="aps-group">';
    echo '<ul class="aps-specs-list">';
    
              if( $fields )
              {
                foreach( $fields as $field_name => $field )
                {
                  if( $field['value'] )
                  {
                      echo ' <li>';
                        echo '<strong class="aps-term">' . $field['label'] . '</strong>';
    echo '<div class="aps-attr-value"><span class="aps-1co">' . $field['value'] . '</span></div>';
    echo '</li>';
                    }
                }
              }
    echo '</ul>';
    echo '</div>';
    echo '</div>';
      
    ?>

    I tried a lot of code but as i am not a php professional i am doing some mistake. Thanks again for your kind support.

  • Hi @james
    Thanks for your reply. The issue is i want this code to pickup the post id automatically. But this is not in wordpress loop. How can i achieve this?

  • Hi John, Sorry for late reply. Yes, I am trying to update that value which are stored by other plugin via ACF Front end form. So that the other plugin will find and use that value.

    The above code is something different. I am not understanding what to do with this code.

  • Thanks John for replying me. Actually, I am trying to setup frontend form using ACF plugin for a CPT that is also build using some other plugin but the values stored via that plugin is in arrray and difficult for me to return with a single meta key as ACF allows us while creating a form.

    The above code is not working. I am trying for achieving it from around a month with no success. or may be i am unable to explain the requirements in a sensible way 🙁

    Hope someday i will get over with this.

    Thanks again

Viewing 11 posts - 1 through 11 (of 11 total)