robincornett/genesis-accessible

Genesis version check in headings.php

Closed this issue · 2 comments

The Genesis version check in headings.php is using the function to check the earliest version of Genesis installed on the server, instead of checking the current version. Activated the plugin on a brand new localhost and got no semantic headings generated by the plugin, only the ones generated by the framework itself.

I think the intent of the plugin here is to check that the site is running nothing less than Genesis 2.0.2, is that correct? If so, I think this check needs to be similar to the one for the minimum version of the Genesis Framework for activation (line 81 of the main plugin file), something like:

// Find Genesis Theme Data
$theme = wp_get_theme( 'genesis' );

// Get the version
$version = $theme->get( 'Version' );

// Set what we consider the minimum Genesis version
$minimum_genesis_version = '2.0.2';

if ( version_compare( $version, $minimum_genesis_version, '<' ) ) {
    return;
}

Once I changed it to this, I was able to see the plugin headings in archives.

If this code is used elsewhere in this plugin, then it should be abstracted into a function.

I do not know the reasoning for the minimum version check, why they are different between the main plugin file (2.0) and this (2.0.2), but since they are so close, I would wonder if the check here is needed? I'm not familiar with this area at all and don't know what change in 2.0.2 would have affected this, so just wondering.