Skip to content

Instantly share code, notes, and snippets.

@jonathandavis
Created December 17, 2013 19:16
Show Gist options
  • Save jonathandavis/8010907 to your computer and use it in GitHub Desktop.
Save jonathandavis/8010907 to your computer and use it in GitHub Desktop.
Patch file fix for issue report #2652
diff --git a/core/flow/Pages.php b/core/flow/Pages.php
index e4539eb..57a12dd 100755
--- a/core/flow/Pages.php
+++ b/core/flow/Pages.php
@@ -197,7 +197,7 @@ class ShoppPage {
$title = apply_filters('shopp_' . get_class_property($classname, 'name') . '_pagetitle', $this->title); // @deprecated Use shopp_storefront_page_title or shopp_{$name}_storefront_page_title instead
$title = apply_filters('shopp_' . get_class_property($classname, 'name') . '_storefront_page_title', $title);
- return $title = apply_filters('shopp_storefront_page_title', $title);
+ return apply_filters('shopp_storefront_page_title', $title);
}
public function slug () {
@@ -851,6 +851,26 @@ class ShoppCollectionPage extends ShoppPage {
parent::__construct($settings);
}
+ public function filters () {
+ parent::filters();
+ add_filter('wp_title', array($this, 'unlabel'), 1, 3);
+ }
+
+ public function unlabel ( $title, $sep, $seplocation ) {
+ global $wp_query;
+
+ $query_object = $wp_query->queried_object;
+ if ( empty($query_object->taxonomy) ) return $title;
+
+ $tax = get_taxonomy($query_object->taxonomy);
+ if ( empty($tax->labels->name) ) return $title;
+
+ $taxlabel = 'right' == $seplocation ? $tax->labels->name . " $sep " : " $sep " . $tax->labels->name;
+ $title = str_replace($taxlabel, '', $title);
+
+ return $title;
+ }
+
public function editlink ( $link ) {
return $this->edit;
}
@@ -886,13 +906,7 @@ class ShoppCollectionPage extends ShoppPage {
$query_object = $wp_query->queried_object;
$stub = parent::poststub();
$wp_query->queried_object = $query_object;
- $wp_query->is_tax = false;
- $wp_query->is_archive = false;
-
- switch ( $query_object->taxonomy ) {
- case ProductTag::$taxon: $wp_query->is_tag = true; break;
- case ProductCategory::$taxon: $wp_query->is_category = true; break;
- }
+ $wp_query->is_post_type_archive = false;
return $stub;
}
Copy link

ghost commented Dec 18, 2013

I'm sorry but how do i use the patchfile?

@sierrab123
Copy link

@deefk,

Take your version of the file and amend it using the guide above to remove the red lines (-) and insert the green ones (+).

Take extra care when deleting and copying and pasting. Be sure to copy all the syntax.

Also keep a copy of the file, so that if you really mess it up, you have a fall back position!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment