venerdì 31 marzo 2017

Android problema "INSTALL_FAILED_INSUFFICIENT_STORAGE"

Non dipende dalla quantità di memoria libera del cellulare.
Ho risolto aggiungendo, l'attributo:

android:installLocation="preferExternal"

dentro la tag manifest.


mercoledì 29 marzo 2017

Visual composer Post Grid Custom meta (ACF)

Script che conselte la lettura dei custom field se si passa il post object invece di un valore testuale (con Acf si impalla).

1) Crea una "custom variable template" con nome custom_meta e chiamabile con {{custom_meta}} 

add_filter( 'vc_gitem_template_attribute_custom_meta', 'vc_gitem_template_attribute_custom_meta', 10, 2 );

function vc_gitem_template_attribute_custom_meta( $value, $data ) {
   /**
    * @var Wp_Post $post
    * @var string $data
    */
   extract( array_merge( array(
      'post' => null,
      'data' => ''
   ), $data ) );

 //  qui la query che interroga la meta key 
 $valori=get_post_meta( $post->ID, 'meta_key', true );

  for($x=0;$x<count($valori);$x++) {

$output.= $valori[$x];

}

}

$output="<div class='vc_gitem-align-center'>".$output."</div>";

   // qui la cosa che deve restituire {{custom_meta}}
   return $output;
}

2) creazione dello shortcode che verrà visualizzato nel template editor di post grid.

add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' );
function my_module_add_grid_shortcodes( $shortcodes ) {
   $shortcodes['vc_custom_post_meta'] = array(
      'name' => __( 'My Custom Post meta', 'my-text-domain' ),
      'base' => 'vc_custom_post_meta',
      'category' => __( 'Content', 'my-text-domain' ),
      'description' => __( 'Show custom post meta', 'my-text-domain' ),
      'post_type' => Vc_Grid_Item_Editor::postType(),
   );

   return $shortcodes;
}
// output function
add_shortcode( 'vc_custom_post_meta', 'vc_custom_post_meta_render' );
function vc_custom_post_meta_render($atts, $content, $tag) {
   return '{{ custom_meta }}';
}

sabato 18 marzo 2017

martedì 14 marzo 2017

Angular Basic

dopo aver installato angular cli

1) dentro la shell di nodesjs ng serve da avviare dentro la cartella del progetto, avvia webserver -> http://localhost:4200

mercoledì 1 marzo 2017