__( 'Bookmarks', 'piratenkleider' ), 'singular_name' => __( 'Bookmark', 'piratenkleider' ), ); $args = array( 'labels' => $labels, 'description' => __( 'Add or manage bookmark entries', 'piratenkleider' ), 'public' => false, 'show_ui' => true, 'menu_position' => 8, 'supports' => array( 'title' ), 'exclude_from_search' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'linktipps','with_front' => FALSE), 'capability_type' => 'post', 'hierarchical' => false, 'menu_icon' => '', ); register_post_type( 'linktipps', $args ); } add_action( 'init', 'piratenkleider_custom_post_linktipps' ); function piratenkleider_taxonomies_linktipps() { $labels = array(); $args = array( 'labels' => $labels, 'hierarchical' => true, 'rewrite' => false, ); register_taxonomy( 'linktipp_category', 'linktipps', $args ); } add_action( 'init', 'piratenkleider_taxonomies_linktipps' ); function piratenkleider_linktipp_metabox() { add_meta_box( 'linktipp_metabox', __( 'Description and target URL', 'piratenkleider' ), 'linktipp_metabox_content', 'linktipps', 'normal', 'high' ); } function linktipp_metabox_content( $post ) { global $defaultoptions; global $options; global $post; wp_nonce_field( plugin_basename( __FILE__ ), 'linktipp_metabox_content_nonce' ); ?>



ID, 'linktipp_text', true ), 'linktipp_text', array('media_buttons'=>false)); ?>

"; $linktipp_imgid = get_post_meta( $post->ID, 'linktipp_imgid', true ); $linktipp_image = get_post_meta( $post->ID, 'linktipp_image', true ); if (isset($linktipp_imgid) && ($linktipp_imgid>0)) { $image_attributes = wp_get_attachment_image_src( $linktipp_imgid, 'linktipp-thumb' ); if (is_array($image_attributes)) { echo ''; $linktipp_image = $image_attributes[0]; } } elseif (filter_var($linktipp_image, FILTER_VALIDATE_URL)) { echo ''; } else { echo ''; } echo '
'; ?> " />


ID ) ? $linktipp->ID : 0; $title = get_the_title($linktipp); $linktipp_url = get_post_meta( $post_id, 'linktipp_url', true ); $linktipp_imgid = get_post_meta( $post_id, 'linktipp_imgid', true ); $linktipp_image = get_post_meta( $post_id, 'linktipp_image', true ); $linktipp_untertitel = get_post_meta( $post_id, 'linktipp_untertitel', true ); $linktipp_text = get_post_meta( $post_id, 'linktipp_text', true ); if (isset($linktipp_untertitel) && !isset($title)) { $title = $linktipp_untertitel; $linktipp_untertitel = ''; } $out = ''; $out .= '
'; $out .= "\n"; if ($options['linktipps-titlepos']!=1) { $out .= '
'; if (mb_strlen(trim($linktipp_untertitel))>1) { $out .= '
'; } if (($options['linktipps-subtitlepos']==0) && (mb_strlen(trim($linktipp_untertitel))>1)) { $out .= '

'.$linktipp_untertitel.'

'; } $out .= '

'; if (($options['linktipps-linkpos']==0) || ($options['linktipps-linkpos']==3)) { $out .= ''; } $out .= $title; if (($options['linktipps-linkpos']==0) || ($options['linktipps-linkpos']==3)) { $out .= ''; } $out .= '

'; if (($options['linktipps-subtitlepos']==1) && (mb_strlen(trim($linktipp_untertitel))>1)) { $out .= '

'.$linktipp_untertitel.'

'; } if (mb_strlen(trim($linktipp_untertitel))>1) { $out .= '
'; } $out .= '
'; $out .= "\n"; } $out .= '
'; $out .= "\n"; $out .= '\n"; if ($options['linktipps-titlepos']==1) { $out .= '
'; if (str_len(trim($linktipp_untertitel))>1) { $out .= '
'; } if (($options['linktipps-subtitlepos']==0) && (str_len(trim($linktipp_untertitel))>1)) { $out .= '

'.$linktipp_untertitel.'

'; } $out .= '

'; if (($options['linktipps-linkpos']==0) || ($options['linktipps-linkpos']==3)) { $out .= ''; } $out .= $title; if (($options['linktipps-linkpos']==0) || ($options['linktipps-linkpos']==3)) { $out .= ''; } $out .= '

'; if (($options['linktipps-subtitlepos']==1) && (str_len(trim($linktipp_untertitel))>1)) { $out .= '

'.$linktipp_untertitel.'

'; } if (str_len(trim($linktipp_untertitel))>1) { $out .= '
'; } $out .= '
'; $out .= "\n"; } if (($options['linktipps-linkpos']==2) || ($options['linktipps-linkpos']==3)) { $out .= ''; } $out .= "
\n"; $out .= "
\n"; return $out; } function linktipps_shortcode( $atts ) { extract( shortcode_atts( array( 'cat' => '', 'num' => 5, ), $atts ) ); $num = sanitize_text_field($num); $cat = sanitize_text_field($cat); if ((isset($cat)) && ( strlen(trim($cat))>0)) { $args = array( 'post_type' => 'linktipps', 'tax_query' => array( array( 'taxonomy' => 'linktipp_category', 'field' => 'slug', 'terms' => $cat ) ), 'posts_per_page' => $num, ); } else { $args = array( 'post_type' => 'linktipps', 'posts_per_page' => $num, ); } $links = new WP_Query( $args ); if( $links->have_posts() ) { $out = ''; while ($links->have_posts() ) { $links->the_post(); $out .= linktipp_display($links->post,'shortcode'); } wp_reset_postdata(); } else { $out = '

'; $out .= __('No bookmarks found.', 'piratenkleider'); $out .= "

\n"; } return $out; } add_shortcode( 'linktipps', 'linktipps_shortcode' );