Jump to content
php.lv forumi

nemiroff

Reģistrētie lietotāji
  • Posts

    23
  • Joined

  • Last visited

Posts posted by nemiroff

  1. Nesen parādījās problēma, ka atjaunotais saturs neuzrādās lapas viesiem, kas jau kādu reizi bijuši portālā. Ja lapu atver pirmo reizi, tad rāda jaunāko saturu, bet nākamreiz vairs ne. Līdz vienīgi refreš poga/F5. Pats izmaiņas redzu uzreiz tad kad esmu ielogojos kā admins/lietotājs wordpresa panelī. 

    Kādi risinājumi? Ja ir tad rakstiet, lūdzu, konkrēti precīzu vietu kur ko ielikt/labot, piemēram, functions.php vai kādā citā failā.

  2. bļin! iedod kodu vai vismaz pasaki kas tas par widgetu...

     

    // Stop direct access of the file

    if(preg_match('#'.basename(__FILE__).'#',$_SERVER['PHP_SELF']))

    die();

     

    class PopularWidget extends WP_Widget {

     

    /**

    * Constructor

    *

    * @return void

    * @since 0.5.0

    */

    function PopularWidget() {

     

    ob_start(); //header sent problems

    if(!defined('POPWIDGET_URL'))

    define('POPWIDGET_URL',WP_PLUGIN_URL."/".plugin_basename(dirname(__FILE__))."/");

     

    $this->version = "1.0.1";

    $this->domain = "pop-wid";

    $this->load_text_domain();

     

    $this->functions = new PopularWidgetFunctions();

    add_action('template_redirect',array(&$this,'set_post_view'));

    add_action('wp_enqueue_scripts',array(&$this,'load_scripts_styles'));

     

    $widget_ops = array('classname' => 'popular-widget','description' => __("Display most popular posts and tags",$this->domain));

    $this->WP_Widget('popular-widget',__('Popular Widget',$this->domain),$widget_ops);

    }

     

    /**

    * Register localization/language file

    *

    * @return void

    * @since 0.5.0

    */

    function load_text_domain(){

    if(function_exists('load_plugin_textdomain')){

    $plugin_dir = basename(dirname(__FILE__)).'/langs/';

    load_plugin_textdomain($this->domain,WP_CONTENT_DIR.'/plugins/'.$plugin_dir,$plugin_dir);

    }

    }

     

    /**

    * Load frontend js/css

    *

    * @return void

    * @since 0.5.0

    */

    function load_scripts_styles(){

    if(is_admin()) return;

    wp_enqueue_style('popular-widget',POPWIDGET_URL.'_css/pop-widget.css',NULL,$this->version);

    wp_enqueue_script('popular-widget',POPWIDGET_URL.'_js/pop-widget.js',array('jquery'),$this->version,true);

    }

     

     

    /**

    * Display widget.

    *

    * @param array $args

    * @param array $instance

    * @return void

    * @since 0.5.0

    */

    function widget($args,$instance) {

    global $wpdb;

     

    extract($args); extract($instance);

    $instance['limit'] = ($limit) ? $limit : 5;

    $instance['days'] = ($lastdays) ? $lastdays : 365;

    $instance['imgsize']= ($imgsize)? $imgsize : 'thumbnail';

    $instance['words'] = ($excerptlength) ? $excerptlength : 15;

     

    $posttypes = (empty($posttypes)) ? $posttypes = array('post'=>'on') : $posttypes;

    foreach($posttypes as $type => $val) $types[] = "'$type'"; $instance['types'] = implode(',',$types);

     

    if($cats){

    $join =

    "INNER JOIN $wpdb->term_relationships tr ON p.ID = tr.object_id

    INNER JOIN $wpdb->term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id

    INNER JOIN $wpdb->terms t ON tt.term_id = t.term_id ";

    $where = "AND t.term_id IN (".trim($cats,',').") AND taxonomy = 'category'";

    }

     

    $tabs = (!$nocommented && !$noviewed && !$notags && !$nocomments)

    ? ' class="pop-widget-tabs pop-tabs-all"': 'class="pop-widget-tabs"';

     

    // start widget //

    $output = $before_widget."\n";

    $output .= '<div class="pop-layout-v">';

    $output .= '<ul id="pop-widget-tabs-'.$this->number.'"'.$tabs.'>';

     

    if(!$nocomments) $output .= '<li><a href="#comments" rel="nofollow">'.__('<span>Recent</span> Comments',$this->domain).'</a></li>';

    if(!$noviewed) $output .= '<li><a href="#viewed" rel="nofollow">'.__(' Apmeklētākie raksti šobrīd',$this->domain).'</a></li>';

    if(!$nocommented) $output .= '<li><a href="#commented" rel="nofollow">'.__('Komentētākie',$this->domain).'</a></li>';

    if(!$notags) $output .= '<li><a href="#tags" rel="nofollow">'.__('Tags',$this->domain).'</a></li>';

     

    $output .= '</ul><div class="pop-inside-'.$this->number.' pop-inside">';

     

    //most comments

    if(!$nocomments){

    $output .= '<ul id="pop-widget-comments-'.$this->number.'">';

    $output .= $this->functions->get_comments($instance);

    $output .= '</ul>';

    }

     

    //most commented

    if(!$nocommented){

    $output .= '<ul id="pop-widget-commented-'.$this->number.'">';

    $output .= $this->functions->get_most_commented($instance);

    $output .= '</ul>';

    }

     

    //most viewed

    if(!$noviewed){

    $output .= '<ul id="pop-widget-viewed-'.$this->number.'">';

    $output .= $this->functions->get_most_viewed($instance);

    $output .= '</ul>';

    }

     

    //tags

    if(!$notags) $output .= wp_tag_cloud(array('smallest'=>'8','largest'=>'22','format'=>"list",'echo'=>false));

     

    $output .= '<div class="pop-cl"></div></div></div>';

    echo $output .= $after_widget."\n";

     

    // end widget //

    }

     

     

    /**

    * Configuration form.

    *

    * @param array $instance

    * @return void

    * @since 0.5.0

    */

    function form($instance) {

    extract($instance);

    $calculate = (empty($calculate)) ? 'visits' : $calculate;

    $post_types = get_post_types(array('public'=>true),'names','and');

    $posttypes = (empty($posttypes)) ? $posttypes = array('post'=>'on') : $posttypes;

    ?>

    <p>

    <label for="<?php echo $this->get_field_id('limit')?>"><?php _e('Show how many posts?',$this->domain)?> <input id="<?php echo $this->get_field_id('limit')?>" name="<?php echo $this->get_field_name('limit')?>" size="4" type="text" value="<?php echo $limit?>"/></label>

    </p>

    <p>

    <label for="<?php echo $this->get_field_id('cats')?>"><?php _e('In categories',$this->domain)?> <input id="<?php echo $this->get_field_id('cats')?>" name="<?php echo $this->get_field_name('cats')?>" size="20" type="text" value="<?php echo $cats?>"/></label><br /><small><?php _e('comma-separated category IDs',$this->domain)?> </small>

    </p>

    <p>

    <label for="<?php echo $this->get_field_id('lastdays')?>"><?php _e('In the last',$this->domain)?> <input id="<?php echo $this->get_field_id('lastdays')?>" name="<?php echo $this->get_field_name('lastdays')?>" size="4" type="text" value="<?php echo $lastdays?>"/> <?php _e('Days',$this->domain)?></label>

    </p>

    <p>

    <label for="<?php echo $this->get_field_id('imgsize')?>"><?php _e('Image Size',$this->domain)?>

    <select id="<?php echo $this->get_field_id('imgsize') ?>" name="<?php echo $this->get_field_name('imgsize') ?>">

    <?php foreach( get_intermediate_image_sizes() as $size):?>

    <option value="<?php echo $size?>" <?php selected($size,$imgsize)?>><?php echo $size?></option>

    <?php endforeach;?>

    </select>

    </label>

    </p>

    <p>

    <label for="<?php echo $this->get_field_id('counter')?>"><input id="<?php echo $this->get_field_id('counter')?>" name="<?php echo $this->get_field_name('counter')?>" type="checkbox" <?php echo($counter)?'checked="checked"':''; ?> /> <?php _e('Display count',$this->domain)?></label><br />

    <label for="<?php echo $this->get_field_id('thumb')?>"><input id="<?php echo $this->get_field_id('thumb')?>" name="<?php echo $this->get_field_name('thumb')?>" type="checkbox" <?php echo($thumb)?'checked="checked"':''; ?> /> <?php _e('Display thumbnail',$this->domain)?></label><br />

     

    <label for="<?php echo $this->get_field_id('excerpt')?>"><input id="<?php echo $this->get_field_id('excerpt')?>" name="<?php echo $this->get_field_name('excerpt')?>" type="checkbox" <?php echo($excerpt)?'checked="checked"':''; ?> /> <?php _e('Display post excerpt',$this->domain)?></label>

    </p>

    <p>

    <label for="<?php echo $this->get_field_id('excerptlength')?>"><?php _e('Excerpt length',$this->domain)?> <input id="<?php echo $this->get_field_id('excerptlength')?>" name="<?php echo $this->get_field_name('excerptlength')?>" size="5" type="text" value="<?php echo $excerptlength?>"/> <?php _e('Words',$this->domain)?></label>

    </p>

    <p>

    <label for="<?php echo $this->get_field_id('tlength')?>"><?php _e('Title length',$this->domain)?> <input id="<?php echo $this->get_field_id('tlength')?>" name="<?php echo $this->get_field_name('tlength')?>" size="4" type="text" value="<?php echo $tlength?>"/> <?php _e('characters',$this->domain)?></label>

    </p>

    <p>

    <?php _e('Calculate:',$this->domain)?><br />

    <label for="<?php echo $this->get_field_id('calculate-views')?>"><input id="<?php echo $this->get_field_id('calculate-views')?>" name="<?php echo $this->get_field_name('calculate')?>" value="views" type="radio" <?php checked($calculate,'views') ?> /> <abbr title="Every time the user views the page"><?php _e('Views',$this->domain)?></abbr></label>

    <label for="<?php echo $this->get_field_id('calculate-visits')?>"><input id="<?php echo $this->get_field_id('calculate-visits')?>" name="<?php echo $this->get_field_name('calculate')?>" value="visits" type="radio" <?php checked($calculate,'visits') ?> /> <abbr title="Every time the user visits the site"><?php _e('Visits',$this->domain)?></abbr></label>

    </p>

    <p>

    <label><?php _e('Post Types:',$this->domain)?></label><br />

    <?php foreach ($post_types as $post_type) { ?>

    <label for="<?php echo $this->get_field_id($post_type)?>"><input id="<?php echo $this->get_field_id($post_type)?>" name="<?php echo $this->get_field_name('posttypes')."[$post_type]"?>" type="checkbox" <?php echo($posttypes[$post_type])?'checked="checked"':''; ?> /> <?php echo $post_type?></label><br />

    <?php }?>

    </p>

    <p><?php _e('Disable:',$this->domain)?><br />

    <label for="<?php echo $this->get_field_id('nocomments')?>"><input id="<?php echo $this->get_field_id('nocomments')?>" name="<?php echo $this->get_field_name('nocomments')?>" type="checkbox" <?php echo($nocomments)?'checked="checked"':''; ?> /> <?php _e('Recent Comments',$this->domain)?></label><br />

    <label for="<?php echo $this->get_field_id('nocommented')?>"><input id="<?php echo $this->get_field_id('nocommented')?>" name="<?php echo $this->get_field_name('nocommented')?>" type="checkbox" <?php echo($nocommented)?'checked="checked"':''; ?> /> <?php _e('Most Commented',$this->domain)?></label><br />

    <label for="<?php echo $this->get_field_id('noviewed')?>"><input id="<?php echo $this->get_field_id('noviewed')?>" name="<?php echo $this->get_field_name('noviewed')?>" type="checkbox" <?php echo($noviewed)?'checked="checked"':''; ?> /> <?php _e('Most Viewed',$this->domain)?></label><br />

    <label for="<?php echo $this->get_field_id('notags')?>"><input id="<?php echo $this->get_field_id('notags')?>" name="<?php echo $this->get_field_name('notags')?>" type="checkbox" <?php echo($notags)?'checked="checked"':''; ?> /> <?php _e('Tags',$this->domain)?></label>

    </p>

    <a href="http://xparkmedia.com/popular-widget/"><?php _e('New! Popular Widget Pro',$this->domain)?></a> |

    <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8SJEQXK5NK4ES"><?php _e('Donate',$this->domain)?></a>

    <?php

    }

     

     

    /**

    * Add postview count.

    *

    * @return void

    * @since 0.5.0

    */

    function set_post_view( ) {

    global $post;

    $widgets = get_option($this->option_name);

    $instance = $widgets[$this->number];

    if((is_single() || is_page() || is_singular) && $instance['calculate'] == 'visits'){

    if(!isset($_COOKIE['popular_views_'.COOKIEHASH]) && setcookie("pop-test", "1", time() + 360)){

    update_post_meta($post->ID,'_popular_views',get_post_meta($post->ID,'_popular_views',true)+1);

    setcookie('popular_views_'.COOKIEHASH,"$post->ID|",0,COOKIEPATH);

    }else{

    $views = explode("|",$_COOKIE['popular_views_'.COOKIEHASH]);

    foreach($views as $post_id) if($post->ID == $post_id) $exist = true;

    if(!$exist){

    $views[] = $post->ID;

    update_post_meta($post->ID,'_popular_views',get_post_meta($post->ID,'_popular_views',true)+1);

    setcookie('popular_views_'.COOKIEHASH,implode("|",$views),0,COOKIEPATH);

    }

    }

    }elseif(is_single() || is_page() || is_singular){

    update_post_meta($post->ID,'_popular_views',get_post_meta($post->ID,'_popular_views',true)+1);

    }

    }

     

    /**

    * Limit the words in a string

    *

    * @param string $string

    * @param unit $word_limit

    * @return string

    * @since 0.5.0

    */

    function limit_words($string, $word_limit){

    $words = explode(" ",$string);

    return implode(" ",array_splice($words,0,$word_limit));

    }

     

     

    }

    include(dirname(__FILE__)."/include.php");

    add_action('widgets_init',create_function('','return register_widget("PopularWidget");'));

    ?>

  3. Hi, viss notiek wordpresā, vajag izmainīt pluginā vienu lietu, ir widgets kuram "ejot" vai uzejot ar peles kursoru uz viņu, viņš paliek skaidrāks, te būs attēls: post-8325-0-22545900-1319184806_thumb.jpg viņš tāds pelēcīgs, bet kad ar peli uziet paliek skaidrs attēls, vajag novākt to pelēcīgo nost, lai visu laiku rāda skaidru bildi, bez tā efekta. murgu jau te sarakstīju, bet gan jau sapratāt.

  4. Kaut kur ir jānomaina kaut kas, kas varētu saukties par base_url vai ka līdzīgi no /wordpress uz /.

     

    Nezinu WordPress tik precīzi lai pateiktu kur tas ir un kā tieši saucas.

     

    P.S. Tu gadījumā nebiji dizaineris? Kāpēc programmē?

    Šodien neko vairs neaiztikšu wp, sadzēros alu hokeja laikā, var sanākt šmuce:D

    Hmm, biju gan jā... kā tu zini? kas ta es pa porgrameri...vairāk kā entuziasts :) un WP vairak vai mazāk ir gatavs produkts ar iespēju šo to pielabot savām vajadzībām.

  5. Tev visi faili ir mapē /wordpress, vai ne? Iznes tos failus (cut -> paste) mapi uz augšu.

     

    /
     / [sheit jābūt tiem failiem] (nav mapes!)
     / wordpress (mape)
       / [pashreiz faili atrodas te]

     

    Tas, protams, ir vieglākais veids. :D

    Nu vo šito sapratu :D paldies! ups, vispār ir gļuks, lapa atveras smuki, bet nevar tikt "dashboard" rāda- "page no found".

     

    Un vēl ir www.piemers.lv/ kad uzspiež piem.uz meņu pogas |sākumu| atveras - www.piemers.lv/wordpress/category/sakums/

    nevar to wordpress nomainīt uz ko citu vai vispār izdzēst, lai aiz .lv/ paliek category ?

  6. Sveiki,

    piemērs, ir - www.piemers.lv atverot viņu rādās balta lapa ar tekstu - Index of / ar linku wordpress, uzspiežot atveras www.piemers.lv/wordpress/ un viss ir tā kā tam jābūt, kur un kas cpanelī jāmaina, lai atverot piemers.lv rādas /wordpress/ saturs?

    skatīt pievienoto skrīnu. post-8325-0-08224200-1318401004_thumb.jpg

  7. Pats vienkāršākais, ātrākais un stulbākais veids būtu atvērt dizaina failu un pārrakstīt no kā līdzīga echo __('posted comment'); uz echo 'Pievienot komentāru';. Tas vismaz strādās... :D

    Viss vienkāršais ir ģeniāls. Paldies, paskatīsimies :)

  8. Sveiki, izdevās ar "custom menu" salikt kategorijas tā lai katra tiek rādīta savas kategorijas meņū. Bet problēma joprojām ir posta izskatā, tas tiek parādīts viss, lai cik bilžu vai tekstu tur būtu. Ar kādu pluginu vai kā citādi parādīt tikai ieskatu?piemēram, kā spoki.lv - tu redzi par ko ir rakstā, ja gribi lasī visu rakstu tad ir jāuzspiež virsū, tas atveras pilnā.

  9. AFAIK tas visdrīzāk ir atkarīgs no izvēlētās tēmas. Manā blogā (skat zemāk) tā nav. Aizej uz sava bloga admin paneli, paņem kādas tēmas un paskaties, kā tajās izskatīsies tavs garadarbs un kā tam izskatīsies kategroiju lapa. Tur tas ir priekšskatīšanas režīmā, t.i., tas nenozīmē, ka visas tēmas uzreiz rādīsies visiem arī pa taisno skatoties tavu blogu.

     

    Gints Plivna

    http://datubazes.wordpress.com/

     

    Visām 3 tēmām kuras pārbaudīju rāda tikai posta nosaukumus.

  10. Tiešam ir tik vienkārši ar tām mājās lapām, vienkārši piereģistrē domeinu, atrodi hostingu un viss? Nav kādi noteikumi par to ko nedrīkst/drīkst ievietot visiem brīvi pieejamā lapā(nav runa par copyright matreāliem un ģenitālijām). Vajag zināt vispārīgus noteikumos. Un kā ar tiem baneriem, piemēram, man kāda firmele piedāvā izvietot savu reklāmu manā lapelē par samaksu, es drīksti to izvietot un saņemt samaksu?Kā ar nodokļiem?

    Galīgi tumša šitā štelle.

  11. Tas tāpēc, ka vienmēr taisu pa lēto.

    Un pa nopietno rakstot, tiešām nezini kādu gatavu tampleti vēlams free, kam tādam? nu neko ūber krutu, kaut vispār kā forumu, tikai ar iespējām pievienot savu stafu un komentēt.

  12. Sveiki, ir ideja izveidot weblapu, kur var useri piereģistrēties,ir profili(bilde,info,utt), ir sadaļas,piemēram, joki,bildes,raksti,tops utt. un reģistrētie tajos var ievietot savus rakstus,bildes ar komentēšanas iespējām, apmēram kā spoki.lv . Varbūt ir kāda gatavs wordpress tamplets kam tādam vai ko līdzīgu ar iespēju pielāgot? vai labāk meklēt kādu kurš to paveiks par lētu naudiņu?

×
×
  • Create New...