public function postsColumns($defaults) { $offset = 2; ///column offset $addlColumns = array(); if (isset($_GET["post_type"]) && MM_Utils::isCustomPostType($_GET["post_type"])) { $addlColumns["core_page_type"] = __('Core Page Type'); } $addlColumns["access_rights"] = __('Access Rights'); $defaults = array_slice($defaults, 0, $offset, true) + $addlColumns + array_slice($defaults, $offset, NULL, true); return $defaults; }
public function filterContent($content) { global $wp_query; if (!is_feed() && !is_search() && !is_archive()) { return $content; } $protectedContent = new MM_ProtectedContentEngine(); $postId = $wp_query->query_vars["page_id"]; if ($protectedContent->protectContent($postId)) { $wpPost = get_post($postId); setup_postdata($wpPost); if ($wpPost && ($wpPost->post_status == "publish" || $wpPost->post_status == "inherit") && ($wpPost->post_type == "post" || $wpPost->post_type == "page" || MM_Utils::isCustomPostType($wpPost->post_type))) { $hasExcerpt = strpos($wpPost->post_content, "<!--more-->"); if ($hasExcerpt) { return substr($wpPost->post_content, 0, $hasExcerpt) . " <a href=\"" . get_permalink($postId) . "\">Read More</a>"; } return $content; } else { return $content; } } $post = get_post($postId); setup_postdata($post); $hasExcerpt = strpos($post->post_content, "<!--more-->"); if ($hasExcerpt) { return substr($post->post_content, 0, $hasExcerpt) . " <a href=\"" . get_permalink($postId) . "\">Read More</a>"; } return "This content is for members only"; }