Remove site name from og:title Yoast seo plugin - wordpress

i have a problem with yoast seo plugin; i want to remove the sitename from og:title.
Actually, the meta og:title, show the content that is TITLE OF PAGE - TITLE OF THE SITE.
<meta property="og:title" content="The title of the page or blog - The title of the site" />
How i could remove the sitename, so the og:title show only the title of the page or blog?
public function og_title( $echo = true ) {
if ( is_singular() ) {
$title = WPSEO_Meta::get_value( 'opengraph-title' );
if ( $title === '' ) {
$title = WPSEO_Frontend::get_instance()->title( '' );
}
else {
// Replace WP SEO Variables
$title = wpseo_replace_vars( $title, get_post() );
}
}
else if ( is_front_page() ) {
$title = ( $this->options['og_frontpage_title'] !== '' ) ? $this->options['og_frontpage_title'] : WPSEO_Frontend::get_instance()->title( '' );
}
else {
$title = WPSEO_Frontend::get_instance()->title( '' );
}
/**
* Filter: 'wpseo_opengraph_title' - Allow changing the title specifically for OpenGraph
*
* #api string $unsigned The title string
*/
$title = trim( apply_filters( 'wpseo_opengraph_title', $title ) );
if ( is_string( $title ) && $title !== '' ) {
if ( $echo !== false ) {
$this->og_tag( 'og:title', $title );
return true;
}
}
if ( $echo === false ) {
return $title;
}
return false;
}
thank you

There is a filter that you can use to modify the og title in Yoast SEO plugin: wpseo_opengraph_title
Add this function to your functions.php. If necessary, replace the sepparator character.
add_filter('wpseo_opengraph_title','mysite_ogtitle', 999);
function mysite_ogtitle($title) {
$sepparator = " - ";
$the_website_name = $sepparator . get_bloginfo( 'name' );
return str_replace( $the_website_name, '', $title ) ;
}

Related

Add message below shipping methods based on taxonomy terms in WooCommerce

I'd like to add a custom message below the available shipping methods in the cart, but only if ALL products in the cart have a tag named 'express'.
Therefore I use this snippet:
add_action( 'woocommerce_after_shipping_rate', 'action_after_shipping_rate', 20, 2 );
function action_after_shipping_rate ( $method, $index ) {
if( 'flat_rate:1' === $method->id ) {
echo __("<p>Arriving on your chosen date between 9am - 1pm Perfect for business addresses & special occasions</p>");
}
if( 'flat_rate:2' === $method->id ) {
echo __("<p>Arriving on your chosen date between 9am - 7pm Perfect for residential addresses</p>");
}
}
add_filter( 'woocommerce_shipping_details', 'hide_shipping_details', 10, 2 );
function hide_shipping_details( $rates, $package ) {
$terms = array( 'express' );
$taxonomy = 'product_tag';
$found = false;
foreach( $package['contents'] as $cart_item ) {
if ( !has_term( $terms, $taxonomy, $cart_item['product_id'] ) ){
$found = true;
break;
}
}
if ( $found === false ) {
remove_action( 'woocommerce_after_shipping_rate', 'action_after_shipping_rate', 20, 2 );
}
}
But right now, the custom message remains if 1 or 2 products have the tag 'express' but not ALL products. Can someone help me solve this problem?
No need to call from one hook to another, while you can just loop through all the products in cart in the woocommerce_after_shipping_rate hook
So you get:
function action_woocommerce_after_shipping_rate( $method, $index ) {
// Settings
$terms = array( 'express', 'tag-1' );
$taxonomy = 'product_tag';
// Initialize
$flag = false;
// Loop through cart items
foreach ( WC()->cart->get_cart() as $cart_item ) {
// Checks if the current product has NOT any of given terms
if ( ! has_term( $terms, $taxonomy, $cart_item['product_id'] ) ) {
$flag = true;
break;
}
}
// When false
if ( ! $flag ) {
// Compare
if ( $method->get_id() === 'flat_rate:1' ) {
$text = 'My text 1';
} elseif ( $method->get_id() === 'flat_rate:3' ) {
$text = 'My text 2';
} elseif ( $method->get_id() === 'local_pickup:1' ) {
$text = 'My text 3';
}
// When isset
if ( isset( $text ) ) {
// Output
echo '<p>' . sprintf( __( '%s', 'woocommerce' ), $text ) . '</p>';
}
}
}
add_action( 'woocommerce_after_shipping_rate', 'action_woocommerce_after_shipping_rate', 10, 2 );

how to remove custom post type from wordpress url?

I have a wordpress website which is using the custom template with custom post types like landing and services.
Each post type have a specific slug in the url like this => (http://example.com/landing/landing-page-name)
I want to change this url (http://example.com/landing/landing-page-name) to this url (http://example.com/landing-page-name).
In fact I need to remove the [landing] phrase from the url. The important thing is that the [landing] is a custom post type in my posts table.
I have tested following solutions:
==> I have changed slug to '/' in rewrite property in register_post_type() --> It breaks the all of landings, posts and pages url (404)
==> I added 'with_front' => false to the rewrite property --> nothing changed
==> I tried to do this with RewriteRule in htaccess --> it did not work or give too many redirects error
I could not get a proper result.
Did anyone solve this problem before?
First, you need to filter the permalink for your custom post type so that all published posts don't have the slug in their URLs:
function stackoverflow_remove_cpt_slug( $post_link, $post ) {
if ( 'landing' === $post->post_type && 'publish' === $post->post_status ) {
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
}
return $post_link;
}
add_filter( 'post_type_link', 'stackoverflow_remove_cpt_slug', 10, 2 );
At this point, trying to view the link would result in a 404 (Page Not Found) error. That's because WordPress only knows that Posts and Pages can have URLs like domain.com/post-name/ or domain.com/page-name/. We need to teach it that our custom post type's posts can also have URLs like domain.com/cpt-post-name/.
function stackoverflow_add_cpt_post_names_to_main_query( $query ) {
// Return if this is not the main query.
if ( ! $query->is_main_query() ) {
return;
}
// Return if this query doesn't match our very specific rewrite rule.
if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
return;
}
// Return if we're not querying based on the post name.
if ( empty( $query->query['name'] ) ) {
return;
}
// Add CPT to the list of post types WP will include when it queries based on the post name.
$query->set( 'post_type', array( 'post', 'page', 'landing' ) );
}
add_action( 'pre_get_posts', 'stackoverflow_add_cpt_post_names_to_main_query' );
try this code , 100% working single custom post type and multiple post type.
add this class in functions.php file in our theme , or create separate file and import into functions.php
class remove_cpt_base {
var $plugin_admin_page;
static $instance = null;
static public function init() {
if (self::$instance == null) {
self::$instance = new self();
}
return self::$instance;
}
function __construct() {
add_action('plugins_loaded', array($this, 'plugins_loaded'));
$this->rcptb_selected = get_option('rcptb_selected', array());
$this->rcptb_selected_keys = array_keys($this->rcptb_selected);
add_action('admin_menu', array($this, 'plugin_menu_link'));
add_filter('post_type_link', array($this, 'remove_slug'), 10, 3);
add_action('template_redirect', array($this, 'auto_redirect_old'), 1);
add_action('pre_get_posts', array($this, 'handle_cpts'), 1);
}
function plugins_loaded() {
load_plugin_textdomain('remove_cpt_base', FALSE, basename(dirname(__FILE__)) . '/languages/');
}
function filter_plugin_actions($links, $file) {
$settings_link = '' . __('Settings') . '';
array_unshift($links, $settings_link);
return $links;
}
function plugin_menu_link() {
$this->plugin_admin_page = add_submenu_page(
'options-general.php',
__('Remove CPT base', 'remove_cpt_base'),
__('Remove CPT base', 'remove_cpt_base'),
'manage_options',
basename(__FILE__),
array($this, 'admin_options_page')
);
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'filter_plugin_actions'), 10, 2);
}
function admin_options_page() {
if (get_current_screen()->id != $this->plugin_admin_page) {
return;
}
global $wp_post_types;?>
<div class="wrap">
<h2><?php _e('Remove base slug from url for these custom post types:', 'remove_cpt_base')?></h2><?php
if (isset($_POST['rcptb_selected_sent'])) {
if (!isset($_POST['rcptb_alternation']) || !is_array($_POST['rcptb_alternation'])) {
$alternation = array();
} else {
$alternation = $_POST['rcptb_alternation'];
}
if (!isset($_POST['rcptb_selected']) || !is_array($_POST['rcptb_selected'])) {
$this->rcptb_selected = array();
} else {
$this->rcptb_selected = $_POST['rcptb_selected'];
}
foreach ($this->rcptb_selected as $post_type => $active) {
$this->rcptb_selected[$post_type] = isset($alternation[$post_type]) ? 1 : 0;
}
$this->rcptb_selected_keys = array_keys($this->rcptb_selected);
update_option('rcptb_selected', $this->rcptb_selected, 'no');
echo '<div class="below-h2 updated"><p>' . __('Settings saved.') . '</p></div>';
flush_rewrite_rules();
}?>
<br>
<form method="POST" action="">
<input type="hidden" name="rcptb_selected_sent" value="1">
<table class="widefat" style="width:auto">
<tbody><?php
foreach ($wp_post_types as $type => $custom_post) {
if ($custom_post->_builtin == false) {?>
<tr>
<td>
<label>
<input type="checkbox" name="rcptb_selected[<?php echo $custom_post->name ?>]" value="1" <?php echo isset($this->rcptb_selected[$custom_post->name]) ? 'checked' : '' ?>>
<?php echo $custom_post->label ?> (<?php echo $custom_post->name ?>)
</label>
</td>
<td>
<label>
<input type="checkbox" name="rcptb_alternation[<?php echo $custom_post->name ?>]" value="1" <?php echo isset($this->rcptb_selected[$custom_post->name]) && $this->rcptb_selected[$custom_post->name] == 1 ? 'checked' : '' ?>>
<?php _e('alternation', 'remove_cpt_base')?>
</label>
</td>
</tr><?php
}
}?>
</tbody>
</table>
<p><?php _e('* if your custom post type children return error 404, then try alternation mode', 'remove_cpt_base')?></p>
<hr>
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save')?>">
</p>
</form>
</div><?php
}
function remove_slug($permalink, $post, $leavename) {
global $wp_post_types;
foreach ($wp_post_types as $type => $custom_post) {
if ($custom_post->_builtin == false && $type == $post->post_type && isset($this->rcptb_selected[$custom_post->name])) {
$custom_post->rewrite['slug'] = trim($custom_post->rewrite['slug'], '/');
$permalink = str_replace('/' . $custom_post->rewrite['slug'] . '/', '/', $permalink);
}
}
return $permalink;
}
function get_current_url() {
$REQUEST_URI = strtok($_SERVER['REQUEST_URI'], '?');
$real_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$real_url .= $_SERVER['SERVER_NAME'] . $REQUEST_URI;
return $real_url;
}
function handle_cpts($query) {
// make sure it's main query on frontend
if (!is_admin() && $query->is_main_query() && !$query->get('queried_object_id')) {
// conditions investigated after many tests
if ($query->is_404() || $query->get('pagename') || $query->get('attachment') || $query->get('name') || $query->get('category_name')) {
// test both site_url and home_url
$web_roots = array();
$web_roots[] = site_url();
if (site_url() != home_url()) {
$web_roots[] = home_url();
}
// polylang fix
if (function_exists('pll_home_url')) {
if (site_url() != pll_home_url()) {
$web_roots[] = pll_home_url();
}
}
foreach ($web_roots as $web_root) {
// get clean current URL path
$path = $this->get_current_url();
$path = str_replace($web_root, '', $path);
// fix missing slash
if (substr($path, 0, 1) != '/') {
$path = '/' . $path;
}
// test for posts
$post_data = get_page_by_path($path, OBJECT, 'post');
if (!($post_data instanceof WP_Post)) {
// test for pages
$post_data = get_page_by_path($path);
if (!is_object($post_data)) {
// test for selected CPTs
$post_data = get_page_by_path($path, OBJECT, $this->rcptb_selected_keys);
if (is_object($post_data)) {
// maybe name with ancestors is needed
$post_name = $post_data->post_name;
if ($this->rcptb_selected[$post_data->post_type] == 1) {
$ancestors = get_post_ancestors($post_data->ID);
foreach ($ancestors as $ancestor) {
$post_name = get_post_field('post_name', $ancestor) . '/' . $post_name;
}
}
// get CPT slug
$query_var = get_post_type_object($post_data->post_type)->query_var;
// alter query
$query->is_404 = 0;
$query->tax_query = NULL;
$query->is_attachment = 0;
$query->is_category = 0;
$query->is_archive = 0;
$query->is_tax = 0;
$query->is_page = 0;
$query->is_single = 1;
$query->is_singular = 1;
$query->set('error', NULL);
unset($query->query['error']);
$query->set('page', '');
$query->query['page'] = '';
$query->set('pagename', NULL);
unset($query->query['pagename']);
$query->set('attachment', NULL);
unset($query->query['attachment']);
$query->set('category_name', NULL);
unset($query->query['category_name']);
$query->set('post_type', $post_data->post_type);
$query->query['post_type'] = $post_data->post_type;
$query->set('name', $post_name);
$query->query['name'] = $post_name;
$query->set($query_var, $post_name);
$query->query[$query_var] = $post_name;
break;
} else {
// deeper matching
global $wp_rewrite;
// test all selected CPTs
foreach ($this->rcptb_selected_keys as $post_type) {
// get CPT slug and its length
$query_var = get_post_type_object($post_type)->query_var;
// test all rewrite rules
foreach ($wp_rewrite->rules as $pattern => $rewrite) {
// test only rules for this CPT
if (strpos($pattern, $query_var) !== false) {
if (strpos($pattern, '(' . $query_var . ')') === false) {
preg_match_all('#' . $pattern . '#', '/' . $query_var . $path, $matches, PREG_SET_ORDER);
} else {
preg_match_all('#' . $pattern . '#', $query_var . $path, $matches, PREG_SET_ORDER);
}
if (count($matches) !== 0 && isset($matches[0])) {
// build URL query array
$rewrite = str_replace('index.php?', '', $rewrite);
parse_str($rewrite, $url_query);
foreach ($url_query as $key => $value) {
$value = (int) str_replace(array('$matches[', ']'), '', $value);
if (isset($matches[0][$value])) {
$value = $matches[0][$value];
$url_query[$key] = $value;
}
}
// test new path for selected CPTs
if (isset($url_query[$query_var])) {
$post_data = get_page_by_path('/' . $url_query[$query_var], OBJECT, $this->rcptb_selected_keys);
if (is_object($post_data)) {
// alter query
$query->is_404 = 0;
$query->tax_query = NULL;
$query->is_attachment = 0;
$query->is_category = 0;
$query->is_archive = 0;
$query->is_tax = 0;
$query->is_page = 0;
$query->is_single = 1;
$query->is_singular = 1;
$query->set('error', NULL);
unset($query->query['error']);
$query->set('page', '');
$query->query['page'] = '';
$query->set('pagename', NULL);
unset($query->query['pagename']);
$query->set('attachment', NULL);
unset($query->query['attachment']);
$query->set('category_name', NULL);
unset($query->query['category_name']);
$query->set('post_type', $post_data->post_type);
$query->query['post_type'] = $post_data->post_type;
$query->set('name', $url_query[$query_var]);
$query->query['name'] = $url_query[$query_var];
// solve custom rewrites, pagination, etc.
foreach ($url_query as $key => $value) {
if ($key != 'post_type' && substr($value, 0, 8) != '$matches') {
$query->set($key, $value);
$query->query[$key] = $value;
}
}
break 3;
}
}
}
}
}
}
}
}
}
}
}
}
}
function auto_redirect_old() {
global $post;
if (!is_preview() && is_single() && is_object($post) && isset($this->rcptb_selected[$post->post_type])) {
$new_url = get_permalink();
$real_url = $this->get_current_url();
if (substr_count($new_url, '/') != substr_count($real_url, '/') && strstr($real_url, $new_url) == false) {
remove_filter('post_type_link', array($this, 'remove_slug'), 10);
$old_url = get_permalink();
add_filter('post_type_link', array($this, 'remove_slug'), 10, 3);
$fixed_url = str_replace($old_url, $new_url, $real_url);
wp_redirect($fixed_url, 301);
}
}
}
}
function rcptb_remove_plugin_options() {
delete_option('rcptb_selected');
}
add_action('init', array('remove_cpt_base', 'init'), 99);
register_activation_hook(__FILE__, 'flush_rewrite_rules');
register_deactivation_hook(__FILE__, 'flush_rewrite_rules');
register_uninstall_hook(__FILE__, 'rcptb_remove_plugin_options');
To the rewrite you just have to change your current slug from ‘cpt-slug’ to ‘/’ and the with-front: ‘false’. And done, you just resave permalinks and the url shouldn’t display the cpt slug anymore.
Having same issue and came across this answer and none of the above mentioned solution works so tried different plugins and the best which worked, removed base slug and solved 404 error try Remove CPT base

Double filters showing on web view on Woocommerce

I'm having a problem with my woocommerce theme, flatsome, but I think the problem is with the widget. The standard woocommerce product filter.
In the web view it shows normally, but on the mobile view the filter gets doubled;
a filter which gives you the standard mobile view-type of filter that pops on the side when clicked,
and another filter which gives an ugly dropdown.
This is the image on mobile view, the one on top has the right filter I want, the one under gives the ugly dropdown
Here's the code of the filter:
<?php
/*
Plugin Name: WooCommerce Product Filter
Plugin URI: http://www.mihajlovicnenad.com/product-filter
Description: Advanced product filter for any Wordpress template! - mihajlovicnenad.com
Author: Mihajlovic Nenad
Version: 6.3.0
Author URI: https://www.mihajlovicnenad.com
Text Domain: prdctfltr
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( !class_exists( 'PrdctfltrInit' ) ) :
final class PrdctfltrInit {
public static $version = '6.3.0';
protected static $_instance = null;
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
do_action( 'prdctfltr_loading' );
$this->includes();
$this->init_hooks();
do_action( 'prdctfltr_loaded' );
}
private function init_hooks() {
register_activation_hook( __FILE__, array( $this, 'activate' ) );
add_action( 'init', array( $this, 'check_version' ), 10 );
add_action( 'init', array( $this, 'init' ), 0 );
}
private function is_request( $type ) {
switch ( $type ) {
case 'admin' :
return is_admin();
case 'ajax' :
return defined( 'DOING_AJAX' );
case 'cron' :
return defined( 'DOING_CRON' );
case 'frontend' :
return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' );
}
}
public function includes() {
include_once( 'lib/pf-characteristics.php' );
include_once( 'lib/pf-widget.php' );
include_once( 'lib/pf-fixoptions.php' );
if ( $this->is_request( 'admin' ) ) {
add_action( 'vc_before_init', array( $this, 'composer' ) );
include_once ( 'lib/pf-settings.php' );
$purchase_code = get_option( 'wc_settings_prdctfltr_purchase_code', '' );
if ( $purchase_code ) {
require 'lib/update/plugin-update-checker.php';
$pf_check = PucFactory::buildUpdateChecker(
'http://mihajlovicnenad.com/envato/verify_json.php?k=' . $purchase_code,
__FILE__
);
}
}
if ( $this->is_request( 'frontend' ) ) {
$this->frontend_includes();
}
}
public function frontend_includes() {
include_once( 'lib/pf-frontend.php' );
include_once( 'lib/pf-shortcode.php' );
}
public function include_template_functions() {
}
public function init() {
do_action( 'before_prdctfltr_init' );
$this->load_plugin_textdomain();
do_action( 'after_prdctfltr_init' );
}
public function load_plugin_textdomain() {
$domain = 'prdctfltr';
$dir = untrailingslashit( WP_LANG_DIR );
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
if ( $loaded = load_textdomain( $domain, $dir . '/plugins/' . $domain . '-' . $locale . '.mo' ) ) {
return $loaded;
}
else {
load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/lang/' );
}
}
public function setup_environment() {
}
public function plugin_url() {
return untrailingslashit( plugins_url( '/', __FILE__ ) );
}
public function template_path() {
return apply_filters( 'prdctfltr_template_path', '/templates/' );
}
public function plugin_path() {
return untrailingslashit( plugin_dir_path( __FILE__ ) );
}
public function plugin_basename() {
return untrailingslashit( plugin_basename( __FILE__ ) );
}
public function ajax_url() {
return admin_url( 'admin-ajax.php', 'relative' );
}
public function version() {
return self::$version;
}
public function composer() {
require_once( 'lib/pf-composer.php' );
}
function check_version() {
$version = get_option( 'wc_settings_prdctfltr_version', false );
if ( $version === false ) {
$check = get_option( 'wc_settings_prdctfltr_always_visible', false );
if ( $check === false ) {
update_option( 'wc_settings_prdctfltr_version', self::$version, 'yes' );
return '';
}
else {
$version = get_option( 'wc_settings_prdctfltr_version', '5.8.1' );
}
}
if ( version_compare( '5.8.2', $version, '>' ) ) {
add_action( 'admin_init', array( &$this, 'fix_database_582' ), 100 );
}
if ( version_compare( '6.0.6', $version, '>' ) ) {
add_action( 'init', array( &$this, 'fix_database_606' ), 100 );
}
}
function fix_database_606() {
global $wpdb;
$default = $wpdb->get_results( "SELECT `option_name`, `option_value` FROM `$wpdb->options` WHERE `option_name` LIKE CONVERT( _utf8 'wc_settings_prdctfltr_%'USING utf8mb4 ) COLLATE utf8mb4_unicode_ci LIMIT 99999" );
if ( !empty( $default ) ) {
$fix_default = array();
include_once( 'lib/pf-options-autoload.php' );
foreach( $default as $k => $v ) {
if ( in_array( $v->option_name, $forbidden_std ) ) {
$wpdb->query( "update $wpdb->options set autoload='yes' where option_name = '$v->option_name';" );
}
else if ( in_array( $v->option_name, $dont_autoload_std ) || substr( $v->option_name, 0, 41 ) == 'wc_settings_prdctfltr_term_customization_' || substr( $v->option_name, 0, 43 ) == 'wc_settings_prdctfltr_filter_customization_' ) {
$wpdb->query( "update $wpdb->options set autoload='no' where option_name = '$v->option_name';" );
}
else if ( in_array( $v->option_name, $autoload_std ) ) {
$wpdb->query( "update $wpdb->options set autoload='yes' where option_name = '$v->option_name';" );
}
else if ( strpos( $v->option_name, 'transient' ) ) {
delete_option( $v->option_name );
}
else {
$fix_default[$v->option_name] = get_option( $v->option_name );
$wpdb->query( "update $wpdb->options set autoload='no' where option_name = '$v->option_name';" );
}
}
if ( !empty( $fix_default ) ) {
$fix_default = json_encode( $fix_default );
update_option( 'prdctfltr_wc_default', $fix_default, 'no' );
}
$templates = get_option( 'prdctfltr_templates', array() );
if ( !empty( $templates ) && is_array( $templates ) ) {
update_option( 'prdctfltr_backup_templates', $templates, 'no' );
foreach( $templates as $k1 => $v1 ) {
if ( !empty( $v1 ) && substr( $v1, 0, 1 ) == '{' ) {
update_option( 'prdctfltr_wc_template_' . sanitize_title( $k1 ), $v1, 'no' );
$templates[$k1] = array();
}
}
}
update_option( 'prdctfltr_templates', $templates, 'no' );
}
update_option( 'wc_settings_prdctfltr_version', self::$version, 'yes' );
}
function fix_database_582() {
global $wpdb;
$wpdb->query( "update $wpdb->options set autoload='yes' where option_name like '%prdctfltr%';" );
$wpdb->query( "delete from $wpdb->options where option_name like '_transient_prdctfltr_%';" );
$wpdb->query( "delete from $wpdb->options where option_name like '_transient_%_prdctfltr_%';" );
$wpdb->query( "delete from $wpdb->options where option_name like 'wc_settings_prdctfltr_%_end';" );
$wpdb->query( "delete from $wpdb->options where option_name like 'wc_settings_prdctfltr_%_title' and option_value = '' ;" );
delete_option( 'wc_settings_prdctfltr_force_categories' );
delete_option( 'wc_settings_prdctfltr_force_emptyshop' );
delete_option( 'wc_settings_prdctfltr_force_search' );
delete_option( 'wc_settings_prdctfltr_caching' );
delete_option( 'wc_settings_prdctfltr_selected' );
delete_option( 'wc_settings_prdctfltr_attributes' );
update_option( 'wc_settings_prdctfltr_version', '6.0.5', 'yes' );
}
function activate() {
if ( false !== get_transient( 'prdctfltr_default' ) ) {
delete_transient( 'prdctfltr_default' );
}
$active_presets = get_option( 'prdctfltr_templates', array() );
if ( !empty( $active_presets ) && is_array( $active_presets ) ) {
foreach( $active_presets as $k => $v ) {
if ( false !== ( $transient = get_transient( 'prdctfltr_' . $k ) ) ) {
delete_transient( 'prdctfltr_' . $k );
}
}
}
}
}
function Prdctfltr() {
return PrdctfltrInit::instance();
}
PrdctfltrInit::instance();
endif;
?>
Simple CSS should be able to fix this. Use media queries to hide the filter with the ugly dropdown on small screens.
Something like:
#media (max-width: 768px) {
.filter-dropdown{
display: none;
}
}
Substitute filter-dropdown with the class name of that filter. Substitute 768px with whichever number of pixels is right for your situation.
Without you pasting code we can't be more specific than that.

How to run my class object with ajax jquery in PHP

I am developing a theme and currently working on import data process. Radium one click import working really fine for my but I want to add some minor change. I have two demos for my client, family law and personal law. I want to give her a choice so that she can install which one she wants in single install. Currently me demo was installed with button click, I just disabled that functionality by jquery e.perventDefault() function to check which button is clicked so that I can set my demo files accordingly.
Its working good and I am able to send my file names properly through ajax $_POST and getting those values in my PHP file.
The real issue is that it never imports my data any more. It sets my file names but does not start my import process. How can I start my import process again ?
Here is my code.
$('.import-process .import-start').click(function(e){
e.preventDefault();
alert('family-law');
$.ajax ({
type: "POST",
url:"path to my file",
data: "family=family",
success: function(data) {
console.log("message sent!");
alert(data);
}
});
});
With this data I am just getting my file names and nothing else at all. Now kindly let me know how can I start my import process either in PHP file or in js file I am totally no where by now. Thanks
Here is full code:
<?php
/**
* Class Radium_Theme_Importer
*
* This class provides the capability to import demo content as well as import widgets and WordPress menus
*
* #since 0.0.2
*
* #category RadiumFramework
* #package NewsCore WP
* #author Franklin M Gitonga
* #link http://radiumthemes.com/
*
*/
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
// Don't duplicate me!
if ( !class_exists( 'Radium_Theme_Importer' ) ) {
class Radium_Theme_Importer {
public $theme_options_framework = 'radium'; //supports radium framework and option tree
public $theme_options_file;
public $widgets;
public $content_demo;
public $flag_as_imported = array( 'content' => false, 'menus' => false, 'options' => false, 'widgets' =>false );
public $imported_demos = array();
public $add_admin_menu = true;
private static $instance;
public function __construct() {
self::$instance = $this;
echo $this->demo_files_path = apply_filters('radium_theme_importer_demo_files_path', $this->demo_files_path);
if($this->me == 'kami'){
echo $this->theme_options_file = apply_filters('radium_theme_importer_theme_options_file', $this->demo_files_path . $this->theme_options_file_name);
} else {
echo $this->theme_options_file = apply_filters('radium_theme_importer_theme_options_file', $this->demo_files_path . $this->theme_options_file_name1);
}
echo $this->widgets = apply_filters('radium_theme_importer_widgets_file', $this->demo_files_path . $this->widgets_file_name);
$this->content_demo = apply_filters('radium_theme_importer_content_demo_file', $this->demo_files_path . $this->content_demo_file_name);
$this->imported_demos = get_option( 'radium_imported_demo' );
if( $this->theme_options_framework == 'optiontree' ) {
$this->theme_option_name = ot_options_id();
}
if( $this->add_admin_menu ) add_action( 'admin_menu', array($this, 'add_admin') );
add_filter( 'add_post_metadata', array( $this, 'check_previous_meta' ), 10, 5 );
add_action( 'radium_import_end', array( $this, 'after_wp_importer' ) );
}
public function add_admin() {
add_submenu_page('themes.php', "Import Demo Data", "Import Demo Data", 'switch_themes', 'radium_demo_installer', array($this, 'demo_installer'));
}
public function check_previous_meta( $continue, $post_id, $meta_key, $meta_value, $unique ) {
$old_value = get_metadata( 'post', $post_id, $meta_key );
if ( count( $old_value ) == 1 ) {
if ( $old_value[0] === $meta_value ) {
return false;
} elseif ( $old_value[0] !== $meta_value ) {
update_post_meta( $post_id, $meta_key, $meta_value );
return false;
}
}
}
public function after_wp_importer() {
do_action( 'radium_importer_after_content_import');
update_option( 'radium_imported_demo', $this->flag_as_imported );
}
public function intro_html() {
?>
<div style="background-color: #F5FAFD; margin:10px 0;padding: 5px 10px;color: #0C518F;border: 2px solid #CAE0F3; clear:both; width:90%; line-height:18px;">
<p class="tie_message_hint">Importing demo data (post, pages, images, theme settings, ...) is the easiest way to setup your theme. It will
allow you to quickly edit everything instead of creating content from scratch. When you import the data following things will happen:</p>
<ul style="padding-left: 20px;list-style-position: inside;list-style-type: square;}">
<li>No existing posts, pages, categories, images, custom post types or any other data will be deleted or modified .</li>
<li>No WordPress settings will be modified .</li>
<li>Posts, pages, some images, some widgets and menus will get imported .</li>
<li>Images will be downloaded from our server, these images are copyrighted and are for demo use only .</li>
<li>Please click import only once and wait, it can take a couple of minutes</li>
</ul>
</div>
<div style="background-color: #F5FAFD; margin:10px 0;padding: 5px 10px;color: #0C518F;border: 2px solid #CAE0F3; clear:both; width:90%; line-height:18px;"><p class="tie_message_hint">Before you begin, make sure all the required plugins are activated.</p></div>
<?php
if( !empty($this->imported_demos) ) { ?>
<div style="background-color: #FAFFFB; margin:10px 0;padding: 5px 10px;color: #8AB38A;border: 2px solid #a1d3a2; clear:both; width:90%; line-height:18px;">
<p><?php _e('Demo already imported', 'radium'); ?></p>
</div><?php
//return;
}
}
public function demo_installer() {
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
if( !empty($this->imported_demos ) ) {
$button_text = __('Import Again', 'radium');
} else {
$button_text = __('Import Demo Data', 'radium');
}
?><div id="icon-tools" class="icon32"><br></div>
<h2>Import Demo Data</h2>
<div class="radium-importer-wrap" data-demo-id="1" data-nonce="<?php echo wp_create_nonce('radium-demo-code'); ?>">
<form method="post">
<?php $this->intro_html(); ?>
<input type="hidden" name="demononce" value="<?php echo wp_create_nonce('radium-demo-code'); ?>" />
<input name="reset" class="panel-save button-primary radium-import-start" type="submit" value="<?php echo $button_text ; ?>" />
<input type="hidden" name="action" value="demo-data" />
<br />
<br />
<div class="radium-importer-message clear">
<?php if( 'demo-data' == $action && check_admin_referer('radium-demo-code' , 'demononce')){
$this->process_imports();
} ?>
</div>
</form>
</div>
<br />
<br /><?php
}
public function process_imports($mine = true, $content = true, $options = true, $widgets = true) {
if ( $content && !empty( $this->content_demo ) && is_file( $this->content_demo ) ) {
$this->set_demo_data( $this->content_demo );
}
if ( $options && !empty( $this->theme_options_file ) && is_file( $this->theme_options_file ) ) {
$this->set_demo_theme_options( $this->theme_options_file );
}
if ( $options ) {
$this->set_demo_menus();
}
if ( $widgets && !empty( $this->widgets ) && is_file( $this->widgets ) ) {
$this->process_widget_import_file( $this->widgets );
}
if($mine){
$this->import_options();
}
do_action( 'radium_import_end');
}
public function add_widget_to_sidebar($sidebar_slug, $widget_slug, $count_mod, $widget_settings = array()){
$sidebars_widgets = get_option('sidebars_widgets');
if(!isset($sidebars_widgets[$sidebar_slug]))
$sidebars_widgets[$sidebar_slug] = array('_multiwidget' => 1);
$newWidget = get_option('widget_'.$widget_slug);
if(!is_array($newWidget))
$newWidget = array();
$count = count($newWidget)+1+$count_mod;
$sidebars_widgets[$sidebar_slug][] = $widget_slug.'-'.$count;
$newWidget[$count] = $widget_settings;
update_option('sidebars_widgets', $sidebars_widgets);
update_option('widget_'.$widget_slug, $newWidget);
}
public function set_demo_data( $file ) {
if ( !defined('WP_LOAD_IMPORTERS') ) define('WP_LOAD_IMPORTERS', true);
require_once ABSPATH . 'wp-admin/includes/import.php';
$importer_error = false;
if ( !class_exists( 'WP_Importer' ) ) {
$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
if ( file_exists( $class_wp_importer ) ){
require_once($class_wp_importer);
} else {
$importer_error = true;
}
}
if ( !class_exists( 'WP_Import' ) ) {
$class_wp_import = dirname( __FILE__ ) .'/wordpress-importer.php';
if ( file_exists( $class_wp_import ) )
require_once($class_wp_import);
else
$importer_error = true;
}
if($importer_error){
die("Error on import");
} else {
if(!is_file( $file )){
echo "The XML file containing the dummy content is not available or could not be read .. You might want to try to set the file permission to chmod 755.<br/>If this doesn't work please use the Wordpress importer and import the XML file (should be located in your download .zip: Sample Content folder) manually ";
} else {
$wp_import = new WP_Import();
$wp_import->fetch_attachments = true;
$wp_import->import( $file );
$this->flag_as_imported['content'] = true;
}
}
do_action( 'radium_importer_after_theme_content_import');
}
/** Import Options Hook added by kami*/
public function import_options() {
//$data = $_POST['data'];
$data = $options_export;
$data = base64_decode( $data );
$data = json_decode( $data, true );
if ( isset( $data ) ) {
foreach ( $data as $key => $value ) {
update_option( $key, wp_kses_post( stripcslashes( $value) ) );
}
}
//die();
}
/** import action ends **/
public function set_demo_menus() {}
public function set_demo_theme_options( $file ) {
// Does the File exist?
if ( file_exists( $file ) ) {
// Get file contents and decode
$data = file_get_contents( $file );
if( $this->theme_options_framework == 'radium') {
//radium framework
$data = unserialize( trim($data, '###') );
} elseif( $this->theme_options_framework == 'optiontree' ) {
//option tree import
$data = $this->optiontree_decode($data);
update_option( ot_options_id(), $data );
$this->flag_as_imported['options'] = true;
} else {
//other frameworks
//$data = json_decode( $data, true );
$data = maybe_unserialize( $data );
}
// Only if there is data
if ( !empty( $data ) || is_array( $data ) ) {
// Hook before import
$data = apply_filters( 'radium_theme_import_theme_options', $data );
update_option( $this->theme_option_name, $data );
$this->flag_as_imported['options'] = true;
}
do_action( 'radium_importer_after_theme_options_import', $this->demo_files_path );
} else {
wp_die(
__( 'Theme options Import file could not be found. Please try again.', 'radium' ),
'',
array( 'back_link' => true )
);
}
}
function available_widgets() {
global $wp_registered_widget_controls;
$widget_controls = $wp_registered_widget_controls;
$available_widgets = array();
foreach ( $widget_controls as $widget ) {
if ( ! empty( $widget['id_base'] ) && ! isset( $available_widgets[$widget['id_base']] ) ) { // no dupes
$available_widgets[$widget['id_base']]['id_base'] = $widget['id_base'];
$available_widgets[$widget['id_base']]['name'] = $widget['name'];
}
}
return apply_filters( 'radium_theme_import_widget_available_widgets', $available_widgets );
}
function process_widget_import_file( $file ) {
// File exists?
if ( ! file_exists( $file ) ) {
wp_die(
__( 'Widget Import file could not be found. Please try again.', 'radium' ),
'',
array( 'back_link' => true )
);
}
// Get file contents and decode
$data = file_get_contents( $file );
$data = json_decode( $data );
// Delete import file
//unlink( $file );
// Import the widget data
// Make results available for display on import/export page
$this->widget_import_results = $this->import_widgets( $data );
}
public function import_widgets( $data ) {
global $wp_registered_sidebars;
// Have valid data?
// If no data or could not decode
if ( empty( $data ) || ! is_object( $data ) ) {
return;
}
// Hook before import
$data = apply_filters( 'radium_theme_import_widget_data', $data );
// Get all available widgets site supports
$available_widgets = $this->available_widgets();
// Get all existing widget instances
$widget_instances = array();
foreach ( $available_widgets as $widget_data ) {
$widget_instances[$widget_data['id_base']] = get_option( 'widget_' . $widget_data['id_base'] );
}
// Begin results
$results = array();
// Loop import data's sidebars
foreach ( $data as $sidebar_id => $widgets ) {
// Skip inactive widgets
// (should not be in export file)
if ( 'wp_inactive_widgets' == $sidebar_id ) {
continue;
}
// Check if sidebar is available on this site
// Otherwise add widgets to inactive, and say so
if ( isset( $wp_registered_sidebars[$sidebar_id] ) ) {
$sidebar_available = true;
$use_sidebar_id = $sidebar_id;
$sidebar_message_type = 'success';
$sidebar_message = '';
} else {
$sidebar_available = false;
$use_sidebar_id = 'wp_inactive_widgets'; // add to inactive if sidebar does not exist in theme
$sidebar_message_type = 'error';
$sidebar_message = __( 'Sidebar does not exist in theme (using Inactive)', 'radium' );
}
// Result for sidebar
$results[$sidebar_id]['name'] = ! empty( $wp_registered_sidebars[$sidebar_id]['name'] ) ? $wp_registered_sidebars[$sidebar_id]['name'] : $sidebar_id; // sidebar name if theme supports it; otherwise ID
$results[$sidebar_id]['message_type'] = $sidebar_message_type;
$results[$sidebar_id]['message'] = $sidebar_message;
$results[$sidebar_id]['widgets'] = array();
// Loop widgets
foreach ( $widgets as $widget_instance_id => $widget ) {
$fail = false;
// Get id_base (remove -# from end) and instance ID number
$id_base = preg_replace( '/-[0-9]+$/', '', $widget_instance_id );
$instance_id_number = str_replace( $id_base . '-', '', $widget_instance_id );
// Does site support this widget?
if ( ! $fail && ! isset( $available_widgets[$id_base] ) ) {
$fail = true;
$widget_message_type = 'error';
$widget_message = __( 'Site does not support widget', 'radium' ); // explain why widget not imported
}
// Filter to modify settings before import
// Do before identical check because changes may make it identical to end result (such as URL replacements)
$widget = apply_filters( 'radium_theme_import_widget_settings', $widget );
// Does widget with identical settings already exist in same sidebar?
if ( ! $fail && isset( $widget_instances[$id_base] ) ) {
// Get existing widgets in this sidebar
$sidebars_widgets = get_option( 'sidebars_widgets' );
$sidebar_widgets = isset( $sidebars_widgets[$use_sidebar_id] ) ? $sidebars_widgets[$use_sidebar_id] : array(); // check Inactive if that's where will go
// Loop widgets with ID base
$single_widget_instances = ! empty( $widget_instances[$id_base] ) ? $widget_instances[$id_base] : array();
foreach ( $single_widget_instances as $check_id => $check_widget ) {
// Is widget in same sidebar and has identical settings?
if ( in_array( "$id_base-$check_id", $sidebar_widgets ) && (array) $widget == $check_widget ) {
$fail = true;
$widget_message_type = 'warning';
$widget_message = __( 'Widget already exists', 'radium' ); // explain why widget not imported
break;
}
}
}
// No failure
if ( ! $fail ) {
// Add widget instance
$single_widget_instances = get_option( 'widget_' . $id_base ); // all instances for that widget ID base, get fresh every time
$single_widget_instances = ! empty( $single_widget_instances ) ? $single_widget_instances : array( '_multiwidget' => 1 ); // start fresh if have to
$single_widget_instances[] = (array) $widget; // add it
// Get the key it was given
end( $single_widget_instances );
$new_instance_id_number = key( $single_widget_instances );
// If key is 0, make it 1
// When 0, an issue can occur where adding a widget causes data from other widget to load, and the widget doesn't stick (reload wipes it)
if ( '0' === strval( $new_instance_id_number ) ) {
$new_instance_id_number = 1;
$single_widget_instances[$new_instance_id_number] = $single_widget_instances[0];
unset( $single_widget_instances[0] );
}
// Move _multiwidget to end of array for uniformity
if ( isset( $single_widget_instances['_multiwidget'] ) ) {
$multiwidget = $single_widget_instances['_multiwidget'];
unset( $single_widget_instances['_multiwidget'] );
$single_widget_instances['_multiwidget'] = $multiwidget;
}
// Update option with new widget
update_option( 'widget_' . $id_base, $single_widget_instances );
// Assign widget instance to sidebar
$sidebars_widgets = get_option( 'sidebars_widgets' ); // which sidebars have which widgets, get fresh every time
$new_instance_id = $id_base . '-' . $new_instance_id_number; // use ID number from new widget instance
$sidebars_widgets[$use_sidebar_id][] = $new_instance_id; // add new instance to sidebar
update_option( 'sidebars_widgets', $sidebars_widgets ); // save the amended data
// Success message
if ( $sidebar_available ) {
$widget_message_type = 'success';
$widget_message = __( 'Imported', 'radium' );
} else {
$widget_message_type = 'warning';
$widget_message = __( 'Imported to Inactive', 'radium' );
}
}
// Result for widget instance
$results[$sidebar_id]['widgets'][$widget_instance_id]['name'] = isset( $available_widgets[$id_base]['name'] ) ? $available_widgets[$id_base]['name'] : $id_base; // widget name or ID if name not available (not supported by site)
$results[$sidebar_id]['widgets'][$widget_instance_id]['title'] = $widget->title ? $widget->title : __( 'No Title', 'radium' ); // show "No Title" if widget instance is untitled
$results[$sidebar_id]['widgets'][$widget_instance_id]['message_type'] = $widget_message_type;
$results[$sidebar_id]['widgets'][$widget_instance_id]['message'] = $widget_message;
}
}
$this->flag_as_imported['widgets'] = true;
// Hook after import
do_action( 'radium_theme_import_widget_after_import' );
// Return results
return apply_filters( 'radium_theme_import_widget_results', $results );
}
public function optiontree_decode( $value ) {
$func = 'base64' . '_decode';
$prepared_data = maybe_unserialize( $func( $value ) );
return $prepared_data;
}
}//class
}//function_exists
?>
Here is my INIT class
<?php
if($_POST){
$theHash = $_POST['hashString'];
echo $theHash; echo "the hash value is";
}
/**
* Version 0.0.3
*
* This file is just an example you can copy it to your theme and modify it to fit your own needs.
* Watch the paths though.
*/
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
// Don't duplicate me!
if ( !class_exists( 'Radium_Theme_Demo_Data_Importer' ) ) {
require_once( dirname( __FILE__ ) . '/importer/radium-importer.php' ); //load admin theme data importer
class Radium_Theme_Demo_Data_Importer extends Radium_Theme_Importer {
/**
* Set framewok
*
* options that can be used are 'default', 'radium' or 'optiontree'
*
* #since 0.0.3
*
* #var string
*/
public $theme_options_framework = 'radium';
public $me = 'dani';
/**
* Holds a copy of the object for easy reference.
*
* #since 0.0.1
*
* #var object
*/
private static $instance;
/**
* Set the key to be used to store theme options
*
* #since 0.0.2
*
* #var string
*/
public $theme_option_name = 'my_theme_options_name'; //set theme options name here (key used to save theme options). Optiontree option name will be set automatically
/**
* Set name of the theme options file
*
* #since 0.0.2
*
* #var string
*/
public $theme_options_file_name = 'theme_options.txt';
public $theme_options_file_name1 = 'theme_options1.txt';
/**
* Set name of the widgets json file
*
* #since 0.0.2
*
* #var string
*/
public $widgets_file_name = 'widgets.json';
/**
* Set name of the content file
*
* #since 0.0.2
*
* #var string
*/
public $content_demo_file_name = 'content.xml';
/**
* Holds a copy of the widget settings
*
* #since 0.0.2
*
* #var string
*/
public $widget_import_results;
/**
* Constructor. Hooks all interactions to initialize the class.
*
* #since 0.0.1
*/
public function __construct() {
$this->demo_files_path = dirname(__FILE__) . '/demo-files/'; //can
self::$instance = $this;
parent::__construct();
}
/**
* Add menus - the menus listed here largely depend on the ones registered in the theme
*
* #since 0.0.1
*/
public function set_demo_menus(){
// Menus to Import and assign - you can remove or add as many as you want
$top_menu = get_term_by('name', 'Top Menu', 'nav_menu');
$main_menu = get_term_by('name', 'Main Menu', 'nav_menu');
$footer_menu = get_term_by('name', 'Main Menu', 'nav_menu');
set_theme_mod( 'nav_menu_locations', array(
'top-menu' => $top_menu->term_id,
'primary' => $main_menu->term_id,
'footer-menu' => $footer_menu->term_id
)
);
$this->flag_as_imported['menus'] = true;
}
}
new Radium_Theme_Demo_Data_Importer;
}
Now here is my question again ... How can I extend this code so that I can import data based on my selection. For that I can send that selection by ajax post as well. Thanks hope that's enough info by now.

Wordpress Adding numbers in urls

I have a problem in wordpress urls. I have the url below
http://www.example.com/sample-post/
but in search engine
http://www.example.com/sample-post/
http://www.example.com/sample-post/500012
http://www.example.com/sample-post/323392
http://www.example.com/sample-post/5
Please give me an idea to tackle this problem.
The answer I found on
https://wordpress.stackexchange.com/questions/70992/appending-numbers-to-url-do-not-break-the-link
http://toscho.de/2010/wordpress-plugin-canonical-permalink/
Description: Removes illegal numeric suffixes from the request URI.
Version: 0.3 Author: Thomas Scholz Author URI: http://toscho.de
Created: 04.04.2010
*/
add_action('wp', 't5_canonical_request'); /** * WordPress allows URIs
with any numeric suffix, e.g.: * /canonical-page-or-postname/12345/
* This functions performs a simple check and redirects * to the canonical URI if neccessary. * * #return void */ function
t5_canonical_request() {
global $page, $post;
// post, page, attachment, preview
if ( ! is_singular() or is_preview() )
{
return;
}
$permalink = get_permalink();
// We don't have access to the number of sub pages here.
// So we have to hack.
$max_pages = substr_count(
$post->post_content, '<!--nextpage-->') + 1;
if ( 1 < $page and $page <= $max_pages )
{
/*
* Handle different permalink settings, eg:
* /%year%/%postname%.html or
* /%year%/%postname%/
*/
$rev_perma_struct = strrev(get_option('permalink_structure'));
if ( '/' != $rev_perma_struct[0] )
{
$permalink .= "/$page";
}
else
{
$permalink .= "$page/";
}
}
$host_uri = 'http'
. ( empty ( $_SERVER['HTTPS'] ) ? '' : 's' )
. '://' . $_SERVER['HTTP_HOST'];
$canonical_path = str_replace($host_uri, '', $permalink);
if ( ! empty ( $_GET ) )
{
global $wp;
// Array
$allowed = $wp->public_query_vars;
$out_arr = array();
foreach ( $_GET as $k => $v )
{
if ( in_array($k, $allowed ) )
{
$out_arr[] = $k . ( empty ( $v ) ? '' : "=$v" );
}
}
if ( ! empty ( $out_arr ) )
{
$canonical_path .= '?' . implode('&', $out_arr);
}
}
if ( $canonical_path == $_SERVER['REQUEST_URI'] )
{
return;
}
// Debug current result:
#print '<pre>' . var_export($canonical_path, TRUE) . '</pre>';
// Change it or return 'false' to stop the redirect.
$canonical_path = apply_filters(
't5_canonical_path',
$canonical_path
);
if ( FALSE != $canonical_path )
{
header('Location: ' . $permalink, true, 301);
die("<a href='$permalink'>$permalink</a>");
}
return; }

Resources