• Thanks for the plugin! Is there any chance to implement testing against some other URL parts or parameter? While using pagination function that comes along with the Advanced Post module from “Ultimate Addons for Beaver Builder” (UABB), the pagination is suffixed with a number (e.g. “paged-2”). So the standard check for being on a paginated site (“paged”) does not work in this case.

Viewing 1 replies (of 1 total)
  • Thread Starter Christian Leuenberg

    (@cleuenberg)

    Hey @sethstevenson, I made some changes in your plugin code to get my feature request done. Would you be so kind to consider this for an update of your plugin?

    added to rules.js:

    // URL
    addRuleType( 'extra-conditional-logic-for-bb/url', {
        label: __( 'URL Fragment' ),
        category: 'browser',
        form: {
            operator: {
                type: 'operator',
                operators: [
                    'equals',
                    'does_not_equal',
                    'starts_with',
                    'ends_with',
                    'contains',
                    'does_not_contain',
                ],
            },
            value: {
                type: 'text',
                defaultValue: '/',
            },
        },
    });

    added to rules.php:

    'extra-conditional-logic-for-bb/url' => array($this, 'url_evaluation'), //as a new rule, line 18

    /**
     * URL Evaluation
     *
     * @param [type] $rule
     * @return void
     * @since 1.0.1
     */
    public function url_evaluation( $rule ) {
    	
    	$url = $_SERVER['REQUEST_URI'];
    
    	// Evaluate the rule compared to the current page and return a boolean
    	return BB_Logic_Rules::evaluate_rule( array(
    		'value' => $url,
    		'operator' => $rule->operator,
    		'compare' => $rule->value,
    	) );
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Checking URL part or parameter’ is closed to new replies.