Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter drsdre

    (@drsdre)

    I confirm that name and acceptedAnswer are in the LD-JSON of the source code. Unfortunately they don’t show up when you unfold the FAQ element under ‘Detected Items’ in the Google Structured Data Testing Tool (see https://search.google.com/test/rich-results?url=https%3A%2F%2Fyoast.com%2Fyoastcon%2Ffaq%2F&user_agent=1).

    However I can verify that given above, still Google is able to detect it and show it accordingly on the Google Search page (see https://www.google.com/search?q=site%3Ayoast.com+yoastcon+faq).

    So let’s close it for know. We will continue to do further research why our FAQ is not showing up in Google Search (probably other policies).

    Thanks,
    Andre

    • This reply was modified 1 month, 4 weeks ago by drsdre.

    Thank you Paul for the investigations and fix. I’ll give you an update after I have tested v3.5.6.

    I can confirm that going back to version 3.5.2 the double insertion works correctly again.

    We are running version 3.5.5 of Insert Pages, but run into this issue again. The same page ID is inserted twice but once with a PHP filter and once with the content. Only the content of the first insert shortcode is shown. Below is an example of this use.

    <div class="signupterms">
    <p class="p1">[insert page='319116' display='promotion-terms-conditions.php' inline public]</p>
    </div>
    <section><div class="termscontent"><a name="promotion-terms-conditions"></a>
    <h2>TERMS AND CONDITIONS</h2>
    [insert page='319116' display='content']
    </div>
    </section>

    Given that we include terms&conditions which are no longer visible, this is a very impactful bug for us.

    Thread Starter drsdre

    (@drsdre)

    Can you be more concrete? What bugs?

    drsdre

    (@drsdre)

    Hi Roch,

    Through the auto-discovery WP rest API for taxonomies (wp-json/wp/v2/taxonomies) and for types (wp-json/wp/v2/types) I’m picking up a whole bunch of SportsPress specific Rest endpoints, like:
    wp-json/wp/v2/positions
    wp-json/wp/v2/seasons
    wp-json/wp/v2/sp_calendar
    wp-json/wp/v2/sp_role
    wp-json/wp/v2/sp_team
    wp-json/wp/v2/sp_venue
    wp-json/wp/v2/venues
    etc.

    What are these endpoints intended for? They do not seem to produce any data, where as the sportspress specific endpoints do (like /wp-json/sportspress/v2/players).

    Thanks,
    Andre

    Thread Starter drsdre

    (@drsdre)

    For convenience, this plugin is now also available on GitHub https://github.com/drsdre/thirstyaffiliates-api

    Thread Starter drsdre

    (@drsdre)

    After some fiddling around, the code below (to be used as a plugin) is doing the job for me. If you implement this, you probably want to add a setting to enable it explicitly and also split the thirstyData field into specific fields.

    <?php
    /**
     * Plugin Name:     ThirstyAffiliates API
     * Plugin URI:      https://github.com/drsdre
     * Description:     Enable WP Core Rest API v2 for ThirstyAffiliates data
     * Author:          Andre Schuurman
     * Author URI:      https://github.com/drsdre
     * Text Domain:     thirstyaffiliates-api
     * Domain Path:     /languages
     * Version:         0.1.0
     *
     * @package         thirstyaffiliates-api
     */
    
    /**
     * Add REST API support to thirstylink post type.
     */
    add_action( 'init', 'thirstylink_post_enable_rest_api', 25 );
    function thirstylink_post_enable_rest_api() {
    	global $wp_post_types;
    
    	$post_type_name = 'thirstylink';
    	if ( isset( $wp_post_types[ $post_type_name ] ) ) {
    		$wp_post_types[ $post_type_name ]->show_in_rest = true;
    		$wp_post_types[ $post_type_name ]->rest_base    = $post_type_name;
    		$wp_post_types[ $post_type_name ]->supports['custom-fields'] = true;
    
    	}
    }
    
    /**
     * Add REST API support to thirstylink-category taxonomy type.
     */
    add_action( 'init', 'thirstylink_category_enable_rest_api', 25 );
    function thirstylink_category_enable_rest_api() {
    	global $wp_taxonomies;
    
    	$taxonomy_name = 'thirstylink_category';
    	if ( isset( $wp_taxonomies[ $taxonomy_name ] ) ) {
    		$wp_taxonomies[ $taxonomy_name ]->show_in_rest = true;
    		$wp_taxonomies[ $taxonomy_name ]->rest_base    = $taxonomy_name;
    
    	}
    }
    
    /**
     * Add REST API support to thirstylink title and thirstyData fields.
     */
    add_action( 'rest_api_init', function () {
    	register_rest_field( 'thirstylink', 'title', [
    		'get_callback'    => function ( $thirstylink_data ) {
    			$thirstylink_obj = get_post( $thirstylink_data['id'] );
    
    			return $thirstylink_obj->post_title;
    		},
    		'update_callback' => function ( $title, $thirstylink_obj ) {
    			$ret = wp_update_post( [
    				'id'         => $thirstylink_obj->ID,
    				'post_title' => $title,
    			] );
    			if ( false === $ret ) {
    				return new WP_Error( 'rest_thirstylink_title_failed', __( 'Failed to update title.' ),
    					[ 'status' => 500 ] );
    			}
    
    			return true;
    		},
    		'schema'          => [
    			'description' => __( 'Thirstylink title.' ),
    			'type'        => 'string',
    		],
    	] );
    
    	register_rest_field( 'thirstylink', 'thirstyData', [
    		'get_callback'    => function ( $thirstylink_data ) {
    			$thirstylink_data_obj = get_post_meta( $thirstylink_data['id'], 'thirstyData', true );
    
    			return $thirstylink_data_obj;
    		},
    		'update_callback' => function ( $data, $thirstylink_obj ) {
    			$ret = update_post_meta( $thirstylink_obj->ID, 'thirstyData', $data);
    
    			if ( false === $ret ) {
    				return new WP_Error( 'rest_thirstylink_data_failed', __( 'Failed to update data.' ),
    					[ 'status' => 500 ] );
    			}
    
    			return true;
    		},
    		'schema'          => [
    			'description' => __( 'Thirstylink data.' ),
    			'type'        => 'string',
    		],
    	] );
    } );

    Another fix I propose, is to not register redirect stats when logged in as admin to prevent skewing the statistics. You need to add two lines of code in the same WordPressStats.php file (marked with –>):

        public function redirect()
        {
            $link = sanitize_text_field(urldecode($_GET['link']));
            $id = sanitize_text_field($_GET['id']);
    
            if (!is_admin()) {    // --> 1. Add this line
    	        WordPressDb::getInstance()->getDb()->insert(
    		        WordPressDb::getInstance()->getDb()->prefix . AEIDN_TABLE_STATS,
    		        [ 'date' => date( 'Y-m-d' ), 'product_id' => $id, 'quantity' => 1 ]
    	        )
    	        ;
            }    // --> And this line
            $link = str_replace('&', '&', $link);
    
            header('Location: ' . $link . '');
            exit();
        }
    • This reply was modified 4 years, 2 months ago by drsdre.

    Always double test…

    Solution is luckily simple. Just keep the existing line:
    add_action('wp_ajax_aeidn_redirect', [$this, 'redirect']);

    And add the new line underneath:
    add_action('wp_ajax_nopriv_aeidn_redirect', [$this, 'redirect']);

    This issue is related to the setup of the click tracker in src/Dnolbon/Wordpress/WordpressStats.php. In line 8 of this file the ajax click handler is setup as:
    add_action('wp_ajax_aeidn_redirect', [$this, 'redirect']);

    This should be changed to:
    add_action('wp_ajax_nopriv_aeidn_redirect', [$this, 'redirect']);

    This allows the ajax action also to be executed for non-logged in users.

    Andre

    Could you apply the following fix in quick-edit-template-link.php on line 99 to prevent PHP Notice errors in certain conditions:
    if (isset($options[‘qetl_checkbox_exectime’]) && $options[‘qetl_checkbox_exectime’] == 1) {

    Thread Starter drsdre

    (@drsdre)

    I’ve switched to using the subscribe widget of Sendgrid for now. I still think this plugin is relevant as the Sendgrid widget loads a bit slow.

    Andre

Viewing 14 replies - 1 through 14 (of 14 total)