Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Unable to use shortcode attribute

$
0
0

I have post type to save user criteria as job alert criteria.
I want to display another post type JOBS as result of alert criteria data filled and saved by user.

So i have custom functions built as shortcodes.

this is my function

function alert_jbtype(){
	$args = array(
    'post_type' => 'alert-subscription',
   	'author_name' => user_name(),
	'post_status' => 'publish'
	 );
	$query_c = new WP_Query ( $args );
	while ( $query_c->have_posts() ) : $query_c->the_post();	
	$terms_as_type = strip_tags( get_the_term_list( $wp_query->post->ID, 'job-type', '', ', ', '' ) );
	return $terms_as_type;
	endwhile;
	wp_reset_postdata();
}
add_shortcode('wpv-al-jbtype', 'alert_jbtype');

When i use above shortcode in a custom query it returns exact results as expected. And if use this sortcode [wpv-al-jbtype] to display values it displays correct.

I have created a view which displays jobs based on job alert post type as mentioned earlier.
Within that view i have a filter to filter job type from jobs based on above shortcode values. Within same shortcode attribute if i use text value like "contract" it displays correct so means view is also correclty created.
Problem is this when i use my custom shortcode within a page with my view it doesnt filter anything and displays all jobs.
And at the end it shows "] also.
i have tried taxonomy slug, taxonomy name both. then i also tried to use echo in function instead of return. then i also tried [wpv-view name="job-alert" jobtype="[wpv-al-jbtype]"] and also [wpv-view name="job-alert" jobtype=[wpv-al-jbtype]] but nothing works for me.

Any help will be highly appreciated.


Viewing all articles
Browse latest Browse all 20145

Trending Articles