Forum Replies Created

Viewing 15 replies - 1 through 15 (of 64 total)
  • Thread Starter Kevin

    (@truheart)

    Ok thanks for the heads up.

    Hi @solstudioim,

    So I spotted one more issue and since it’s related to the OP I figured I would include it here. The credit card fields also don’t show if the checkout is being displayed via a shortcode on a page template other than the checkout template. This looks due to the is_checkout() requirement. If the checkout is being displayed via shortcode, and that shortcode is not included within the post_content, it won’t display.

    I was testing with twentytwentytwo which wasn’t working, but just tested twentytwentyone and now it is. After doing some digging, looks like this could happen if add_theme_support( 'woocommerce' ); isn’t declared by the theme. Once this is included it fixes everything.

    • This reply was modified 3 years, 1 month ago by Kevin.

    Seeing a similar issue. Caching plugins have been disabled and I am having issues whether logged in or not. Here is the error I am seeing in the JS console:

    jquery.min.js?ver=3.6.0:2 Uncaught ReferenceError: wc is not defined
        at L (upe_checkout.js?ver=3.6.1:1:81463)
        at HTMLDocument.<anonymous> (upe_checkout.js?ver=3.6.1:1:94594)
        at e (jquery.min.js?ver=3.6.0:2:30038)
        at t (jquery.min.js?ver=3.6.0:2:30340)

    Not sure why the variable isn’t available here. Any ideas?

    Thread Starter Kevin

    (@truheart)

    Sorry, looks like it actually was my javascript. I found this little course preview from Zac Gordon that helped alot Decoupled WordPress with Vanilla JavaScript and Fetch

    
    fetch( this.route + '?account_info=' + account_changes, {
    
        method: 'POST'
    
    } )
    .then( function( response ) {
    
        // Error
        if( response.status !== 200 ) {
    
            console.log( 'Problem! ', response );
    
        }
        // Success 
        response.json().then( function( wp_response ) {
    
            console.log( wp_response );
    
        } );
    
    } )
    .catch( function( err ) {
    
        console.log( 'Server Error: ', err );
    
    } );
    
    • This reply was modified 7 years, 7 months ago by Kevin.

    Don’t know if anyone is still looking for a solution for this, but I figured out the problem. Before accessing it via the rest api, you need to first register your meta key with https://codex.www.ads-software.com/Function_Reference/register_meta. When registering, make sure $object_type is set to 'user' and within the args you have 'show_in_rest' => true.

    Thread Starter Kevin

    (@truheart)

    Also, I just removed the query filter and tried the default archive for my articles post type. It gave the same result. Without any modifications to the main query, the archive is showing the initial 3 posts then infinite scroll reloads them as it initializes, so the issue must be somewhere else.

    Thread Starter Kevin

    (@truheart)

    Thanks, the problem is for this site I need the main archive pages and searches to retrieve posts from the “articles” custom post type I set up. I might be missing another solution to this, but since it doesn’t seem like there will be a blog any time soon I figured it would be simplest to alter the main query on these pages.

    Thread Starter Kevin

    (@truheart)

    Actually I forgot about this. It is a function to help with archive queries, I am assuming this might be related:

    **
     * Archive queries
     */
    function nymj_query( $query ) {
    
      if( !is_admin() ) {
    
        if( $query->is_archive() || $query->is_search() ) {
    
          $query->set( 'post_type', array(
            'post',
            'articles'
          ) );
        }
      }
    
    }
    add_filter( 'pre_get_posts', 'nymj_query' );
    Thread Starter Kevin

    (@truheart)

    Thanks, I really appreciate the quick response. Unfortunately neither of these seem to be causing the issue. Just in case I changed the ID, and article-snippet doesn’t really contain anything that would effect the query. Just in case here is the code (some custom functions but none that I would think would cause issues here:

    $fields = nymj_get_fields([
    	'pdf',
    	'localize--summary'
    ]);
    $cat = get_the_terms( get_the_id(), 'category' );
    $cat_name = sprintf( __( '%s', 'nymj' ), $cat[0]->name );
    $title = get_the_title();
    $authors = nymj_get_authors();
    
    $issue = get_the_terms( $current_id, 'issue' );
    $issue_date = get_field( 'meta_issue_published_date', 'issue_' . $issue[0]->term_id );
    $issue_date = sprintf( __( '%s', 'nymj' ), $issue_date );
    
    $url = get_post_permalink();
    $summary = $fields['summary'];
    if( !$summary ) {
    	$summary = nymj_make_summary( 150 );
    }
    ?>
    
    <!-- SINGLE SNIPPET -->
    <article class="article-snippet" itemscope itemtype="https://schema.org/MedicalScholarlyArticle">
    
    	<!-- Tag -->
    	<div class="article-snippet__tag" itemprop="articleSection"><?php echo $cat_name; ?></div>
    
    	<div class="article-snippet__content-wrap">
    
    		<!-- Title -->
    		<h3 class="article-snippet__title" itemprop="headline">
    			<span class="main"><?php echo $title; ?></span>
    		</h3>
    
    		<!-- Summary -->
    		<p class="article-snippet__summary" itemprop="description">
    			<?php echo $summary; ?>
    		</p>
    
    		<!-- Meta -->
    		<div class="article-snippet__meta">
    
    			<div class="authors">
    				<i><?php _e( 'by', 'nymj' ); ?></i>
    				<ul>
    					<li itemprop="author"><?php echo $authors[0]; ?></li>
    				</ul>
    			</div>
    
    			<div class="published" itemprop="datePublished">
    				<?php echo $issue_date; ?>
    			</div>
    
    			<div class="links">
    				<ul class="inline-list">
    					<li><?php if( function_exists( 'sharing_display' ) ) { sharing_display( '', true ); } ?></span></li>
    					<?php if( $fields['pdf'] ) { ?>
    						<li><a href="<?php echo $fields['pdf']['url']; ?>" title="<?php _e( 'Download the PDF', 'nymj' ); ?>" target="_blank"><i class="icon-pdf"></i><?php _e( 'PDF', 'nymj' ); ?></a></li>
    					<?php } ?>
    					<li><a href="<?php echo $url; ?>" itemprop="url"><?php _e( 'Read Full Text', 'nymj' ); ?></a></li>
    				</ul>
    			</div>
    
    		</div>
    
    	</div>
    
    </article>
    Thread Starter Kevin

    (@truheart)

    Angelleye, thanks for the support. At the time we had to go with another solution because my client wasn’t receiving payments. I haven’t had a chance to test it out but I will mark this thread as resolved and maybe you can confirm with others on their threads?

    If I do get a chance to test this is some time soon I will follow up on here and let you know.

    Thanks again.

    Thread Starter Kevin

    (@truheart)

    Thanks Craig I actually did it right before you responded. My client’s site is not showing alerts for plugin updates which is why I missed it. Thanks for such a quick response.

    Thread Starter Kevin

    (@truheart)

    Hi Frank,

    Yes I double checked a couple of times and it would always end in the same result. There might have been some timeout settings on the server causing some conflicts, but again, if this were the case would the this be the error I’d be receiving?

    Thread Starter Kevin

    (@truheart)

    So the above code actually is working fine. Hopefully someone might be helped by this at some point. Here is a simplified example of the working code:

    $args = array(
    	'meta_query' => array(
    		array(
    			'key'	=> 'meta_issue_published_date',
    			'value'	=> '^(' . $date . ')',
    			'compare'	=> 'REGEXP'
    		)
    	),
    );
    $issues = get_terms( 'issue', $args );

    Thread Starter Kevin

    (@truheart)

    Ok so real easy problem to spot, obviously the $args are formatted incorrectly. Here is the new code

    // Get all issues belonging to the year
    $args = array(
    	'meta_query' => array(
    		array(
    			'key'	=> 'meta_issue_published_date',
    			'value'	=> '^(2015)',
    			'compare'	=> 'REGEXP'
    		)
    	),
    );

    Still isn’t working though. I’ll keep plugging away.

Viewing 15 replies - 1 through 15 (of 64 total)