Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Release pending.
* Added: Block Editor Support Custom Post Type Pinseldisko
* Added: Block Editor Support Custom Post Type Raketenstaub
* Changed: Maintenance Mode Internal Processing
* Changed: Depreciated TSF Filters replaced with the_seo_framework_meta_render_data
* Removed: Adding Current Menu Item

### 0.7
Expand Down
200 changes: 188 additions & 12 deletions unmus_seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ function unmus_seo_framework_filter_stack() {

// Disable Cannonical for Archives and Pages without Content
if ( is_archive() OR is_search() OR ( is_paged() AND is_home() ) OR is_page('wordpress') OR is_page('notify-me')) {
add_filter( 'the_seo_framework_rel_canonical_output', '__return_false' );
add_filter('the_seo_framework_meta_render_data','unmus_seo_framework_meta_remove_canonical');
}

// Create Next, Create Previous & Overwrite Canonicals @ Mathilda
if(function_exists('mathilda_activate')) {
if( mathilda_is_tweet_page() ) {
add_filter( 'the_seo_framework_paged_url_output_prev', 'mathilda_prev_meta_output' );
add_filter( 'the_seo_framework_paged_url_output_next', 'mathilda_next_meta_output' );
add_filter( 'the_seo_framework_rel_canonical_output', 'mathilda_canonical' );
add_filter('the_seo_framework_meta_render_data','mathilda_set_prev');
add_filter('the_seo_framework_meta_render_data','mathilda_set_next');
add_filter('the_seo_framework_meta_render_data','mathilda_set_canonical');
}
}

// Create Next, Create Previous & Overwrite Canonicals @ TootPress
if(function_exists('tootpress_activate')) {
if( tootpress_toot_here() ) {
add_filter( 'the_seo_framework_paged_url_output_prev', 'tootpress_prev_meta_output' );
add_filter( 'the_seo_framework_paged_url_output_next', 'tootpress_next_meta_output' );
add_filter( 'the_seo_framework_rel_canonical_output', 'tootpress_canonical' );
add_filter('the_seo_framework_meta_render_data','tootpress_set_prev');
add_filter('the_seo_framework_meta_render_data','tootpress_set_next');
add_filter('the_seo_framework_meta_render_data','tootpress_set_canonical');
}
}

Expand Down Expand Up @@ -223,9 +223,11 @@ function mathilda_prev_meta_output() {

$mathilda_subpage=mathilda_which_page();
$number_of_pages=mathilda_pages();

$mathilda_permalink=get_permalink();
$mathilda_permalink=$mathilda_permalink . ($mathilda_subpage-1)."/";

if($mathilda_subpage>2) {
$mathilda_permalink=$mathilda_permalink . ($mathilda_subpage-1)."/";
}

if($mathilda_subpage==1) {
$mathilda_permalink=false;
Expand Down Expand Up @@ -281,10 +283,12 @@ function tootpress_prev_meta_output() {

$tootpress_subpage=tootpress_get_query_var();
$number_of_pages=tootpress_amount_of_pages();

$tootpress_permalink=get_permalink();
$tootpress_permalink=$tootpress_permalink . ($tootpress_subpage-1)."/";


if($tootpress_subpage>2) {
$tootpress_permalink=$tootpress_permalink . ($tootpress_subpage-1)."/";
}

if($tootpress_subpage==1) {
$tootpress_permalink=false;
}
Expand All @@ -294,4 +298,176 @@ function tootpress_prev_meta_output() {
}
}

// TSF 5.0
// New technical approach
// Background: depreciated filters

/**
* Removes the Canonical Link
*
* @since 0.8
*
* @param array $tags_render_data
* @return array $tags_render_data
*/

function unmus_seo_framework_meta_remove_canonical($tags_render_data) {

unset( $tags_render_data['canonical'] );
return $tags_render_data;

}

/**
* Set Tootpress Canonical
*
* @since 0.8
*
* @param array $tags_render_data
* @return array $tags_render_data
*/

function tootpress_set_canonical($tags_render_data) {

$tags_render_data['canonical']['attributes']['href'] = tootpress_canonical();
return $tags_render_data;

}

/**
* Set Tootpress Next Link
*
* @since 0.8
*
* @param array $tags_render_data
* @return array $tags_render_data
*/

function tootpress_set_next($tags_render_data) {

$next_meta_content=tootpress_next_meta_output();

if($next_meta_content!='') {

$tags_render_data['next'] = [

'tag' => 'link',
'attributes' => [
'rel' => 'next',
'href' => $next_meta_content,
]
];

}

return $tags_render_data;

}

/**
* Set Tootpress Prev Link
*
* @since 0.8
*
* @param array $tags_render_data
* @return array $tags_render_data
*/

function tootpress_set_prev($tags_render_data) {

$prev_meta_content=tootpress_prev_meta_output();

if($prev_meta_content!='') {

$tags_render_data['prev'] = [

'tag' => 'link',
'attributes' => [
'rel' => 'prev',
'href' => $prev_meta_content,
]
];

}

return $tags_render_data;

}

/**
* Set Mathilda Canonical
*
* @since 0.8
*
* @param array $tags_render_data
* @return array $tags_render_data
*/

function mathilda_set_canonical($tags_render_data) {

$tags_render_data['canonical']['attributes']['href'] = mathilda_canonical();
return $tags_render_data;

}

/**
* Set Mathilda Next Link
*
* @since 0.8
*
* @param array $tags_render_data
* @return array $tags_render_data
*/

function mathilda_set_next($tags_render_data) {

$next_meta_content=mathilda_next_meta_output();

if($next_meta_content!='') {

$tags_render_data['next'] = [

'tag' => 'link',
'attributes' => [
'rel' => 'next',
'href' => $next_meta_content,
]
];

}

return $tags_render_data;

}

/**
* Set Mathilda Prev Link
*
* @since 0.8
*
* @param array $tags_render_data
* @return array $tags_render_data
*/

function mathilda_set_prev($tags_render_data) {

$prev_meta_content=mathilda_prev_meta_output();

if($prev_meta_content!='') {

$tags_render_data['prev'] = [

'tag' => 'link',
'attributes' => [
'rel' => 'prev',
'href' => $prev_meta_content,
]
];

}

return $tags_render_data;

}

?>