Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
mpindado
tagDiv Member

Hi, just some thoughts (kinda busy this week…),

– Is it suitable for you to have a direct conversion from 0-5 in 0.5 steps to 0-20? (0=>0, 0.5=>2, 1=>4,1.5=>6….) In this case you could only review even values on the 0-20 scale.

Then, you could add save_post action in your child theme and check whether a review exists, do the conversion, and store the result in a convenient way as a post_meta.
Please note td review meta is an array so if you want to extract the values from the database, you would have to do it with a php script or similar but, if you store your own meta value, then this value can already be a number, and this will be easier.

to summarize:

add_action ('save_post','test_save_post',10,3);
function test_save_post ($post_id, $post, $update )
{
if (isset ($_POST['td_review']) && isset ($_POST['td_review']['p_review_stars']) &&
count ($_POST['td_review']['p_review_stars'])){
$my_value = $_POST['td_review']['p_review_stars'][0]['rate']*4;
update_post_meta ($post_id,'my_review',$my_value);// got even 0-20 numbers in 'my_review' meta. select post_id,meta_value from wp_postmeta where meta_key = 'my_review'
}
}

If you check your meta table, you will see a new meta attached to the post with your review.

– No way, I need the odd numbers from 0 to 20. There are several alternatives here, some involving php code and other javascript code but it gets more difficult than previous approach. To avoid waste both your and my time, if you are interested, reply to this post and I will give you some hints.

regards

mpindado
tagDiv Member

Hi, I once dit it this way in the child theme:

//functions.php

add_action( 'after_setup_theme', 'my_change_metabox' );
function my_change_metabox ()
{
if (is_admin()) {
$my_td_metabox_theme_settings = new WPAlchemy_MetaBox(array(
'id' => 'td_post_theme_settings',
'title' => 'Post settings',
'types' => array('post','page','cpt'),
'priority' => 'high',
'template' => get_template_directory() . '/includes/wp_booster/wp-admin/content-metaboxes/td_set_post_settings.php',
));
}
}

regards

mpindado
tagDiv Member

that’s fine for me.
Thanks!

mpindado
tagDiv Member

Sure,

Look at Homepage – loop page of newsmag template.

Search the row where content and sidebar should be aligned. Click on the edit row button

http://www.screencast.com/t/m0CfvT8j

Add the css class td-ss-row to the row
http://www.screencast.com/t/5BtzCYsoVf

Best regards

mpindado
tagDiv Member

reply to myself!….. just adding td-ss-row to the css row in visual composer.

mpindado
tagDiv Member

Hi, you should actually put it in functions.php after parent theme has been setup, something like this:

add_action( ‘after_setup_theme’, ‘child_after_setup_theme’ );

function child_after_setup_theme ()
{
td_api_module::update_key(‘td_module_1′,’file’,get_stylesheet_directory() . ‘/XXX-RELATIVE-PATH-FROM-CHILD-THEME/td_module_1.php’);
}

Best regards

mpindado
tagDiv Member

Thank you so much!

I see then modules may be redefined in this way in child theme:

td_api_module::update_key(‘td_module_1′,’file’,get_stylesheet_directory() . ‘/override/modules/td_module_1.php’);

mpindado
tagDiv Member

Hi,
struggling for this to work in newsmag I found two alternatives I would like to share:

1. Do the same as this,
but add one item to the array named ‘installed_post_types’ with the post-types needed:
‘installed_post_types’=>’post,page’

This approach has the disadvantage of touching the theme source code.

2. This is kind of tricky: create a child-theme and a new folder named ‘override’ or whatever. Copy td_block_mega_menu.php to that folder (Note that this file is internal and is not overriden by the general child theme method described in the documentation). In that copy, change render method to add ‘installed_post_types’ to the array before performing the query as in the previous paragraph.
Now, in your functions.php create a hook for ‘after_setup_theme’. This will be get called after parent newsmag/newspaper theme is finished.
Then you will have to change the api file for the megamenu block, invoking td_api_block::update_key (‘td_block_mega_menu’,’file’,FULLPATHTOMYNEWFILE);
Now when a megamenu is to be created, the overriden file is chosen instead of the core one.
This method is valid for updating some api blocks and files without touching parent theme.

P.D. Forgot to mention, first of all you should add category taxonomy to pages, using a plugin or in child-theme with register_taxonomy_for_object_type

Best regards

  • This reply was modified 11 years by mpindado.
  • This reply was modified 11 years by mpindado. Reason: wrong link
Viewing 8 posts - 1 through 8 (of 8 total)