virtualvoice
asked 8 years ago

We bought DWQA Pro yesterday.

I am trying to find a way of modifying things so that each question category can be displayed on its own individual WordPress page – We’re having trouble with one themes custom links in menus, and we’d like to display product specific offers on the page showing q&a’s related to each particular piece of software.

My first thought would be to create a shortcode for each category like [dwqa-list-questions] that showed only q&a’s from the desired category. I’ve looked at the “Shortcodes.php” file and see an apparently deprecated [dwqa-question-list] shortcode where the function was commented out. It appears to require an attribute and doesn’t do anything when enabled.

Has anyone come up with a good solution for this?

Thanks!

1 Answers
Allen
answered 8 years ago

well, you can try this short code :
[dwqa-list-questions category=”< slug of the category from dashboard >”]

virtualvoice
replied 8 years ago

Thanks Allen.

However, the [dwqa-list-questions] does not accept or pass any arguments. See "Shortcodes.php" so the result is a list of all categories.

[dwqa-question-list] <em>does</em> accept arguments for category, number, title, etc. It recognizes the title, but does not spit out the question list from the category. I haven't dug in to why. I was hoping for a simpler (faster) solution that didn't require manipulating the code.

Allen
replied 8 years ago

yes i accept, you can check the code :

in the function : archive_question()

the code :
if ( isset( $atts[‘category’] ) ) {
$args[‘tax_query’][] = array(
‘taxonomy’ => ‘dwqa-question_category’,
‘terms’ => $atts[‘category’],
‘field’ => ‘slug’
);
}

mean it accept the parameter “category” by slug
you can use : [dwqa-list-questions category=””]

virtualvoice
replied 8 years ago

Perhaps we have an outdated version?

 

Passing that argument has no effect, it returns all categories. And if you examine our "Shortcode.php" you see why – it does not accept an argument..

add_shortcode( 'dwqa-list-questions', array( $this, 'archive_question') );

.
.
.

public function archive_question() {
global $dwqa, $script_version, $dwqa_sript_vars;
ob_start();

.
.
.

Allen
replied 8 years ago

i'm not sure but the latest version of DW Q&A pro is 1.0.7

And you can replace this code here :
—————————————————————-

public function archive_question( $atts ) {
global $dwqa, $script_version, $dwqa_sript_vars;
ob_start();

$args = array();

if ( isset( $atts['category'] ) ) {
$args['tax_query'][] = array(
'taxonomy' => 'dwqa-question_category',
'terms' => $atts['category'],
'field' => 'slug'
);
}

$dwqa->template->remove_all_filters( 'the_content' );
$dwqa->filter->prepare_archive_posts( $args );
echo '<div class="dwqa-container" >';
dwqa_load_template( 'archive', 'question' );
echo '</div>';
$html = ob_get_contents();

$dwqa->template->restore_all_filters( 'the_content' );

ob_end_clean();
wp_enqueue_script( 'jquery-ui-autocomplete' );
wp_enqueue_script( 'dwqa-questions-list', DWQA_URI . 'templates/assets/js/dwqa-questions-list.js', array( 'jquery', 'jquery-ui-autocomplete' ), $script_version, true );
wp_localize_script( 'dwqa-questions-list', 'dwqa', $dwqa_sript_vars );
return apply_filters( 'dwqa-shortcode-question-list-content', $this->sanitize_output( $html ) );
}

virtualvoice
replied 8 years ago

OK. I'll try that in the morning. We have v1.01. We bought it just two days ago. It has not signaled an update is available. Thank you for your help!

Allen
replied 8 years ago

ok mate !

virtualvoice
replied 8 years ago

How do we get v1.07?

Allen
replied 8 years ago

well i think if you bought it from codecanyon, you can download the latest version 1.0.7 from there, if you can’t, you can contact to our mail : [email protected]. Our’team will check and send you the package.

Powered by DW Question & Answer Pro