Forum Replies Created

Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter chachalady

    (@chachalady)

    I updated wordpress to 3.5.1 , permalink strukture /%postname%/ is working, but I still have that error mesage about .htaccess file:
    …if your htaccess were file writeable we could do this automatically …

    I was wondering if anyone has the same situation – permalink structure working althogh wordpress doesn’t recognize that .htaccess is writable ?!!!

    Site is on Brinkster server ( windows but php is supported) I checked and .htaccess has all the read write permissions (I think – I can go to control panel and I can see files and folders permissions although I can not change them, but all permissins for .htaccess are checked, read and write…)

    What problems can I expect to encounter due to that error message about .htaccess not writable?

    Thanks.

    Thread Starter chachalady

    (@chachalady)

    I found a working code after all! ??
    After hours and hours searching and browsing through similar topics I end up with this solution:

    I add :

    ob_start();

    to the first line of the function,

    and at the end of the function I add :

    $output = ob_get_clean();
    return $output;

    And it works well! Shortcode generated output is in the middle of the text where I put it.

    Complete code if someone needs to do similar thing:

    <?php
    /**
    * MY SHORTCODE
    **/
    function display_images_in_list($atts) {
    
    	ob_start(); 
    
    	extract(shortcode_atts(array(
          'velicina' => 'thumbnail',
       ), $atts));
    
    echo "<div class='slideshow pics'>";
    
    	if($images = get_posts(array(
    		'post_parent'    => get_the_ID(),
    		'post_type'      => 'attachment',
    		'numberposts'    => -1, // show all
    		'post_status'    => null,
    		'post_mime_type' => 'image',
            'orderby'        => 'menu_order',
            'order'           => 'ASC',
    	))) {
    		foreach($images as $image) {
    	$attimg = wp_get_attachment_image($image->ID,$velicina);
    
    	$attimgpageurl = get_attachment_link($image->ID);
    
       echo "<div class='slajd'><a href='".$attimgpageurl."'>".$attimg."</a></div>";
    
    		}
    	}
      echo "</div><div id='nav'></div>";
      $output = ob_get_clean();
      return $output;
    }
    ?>
    <?php
    function register_shortcodes(){
       add_shortcode('galerija-cycle', 'display_images_in_list');
    }
    ?>
    <?php
    add_action( 'init', 'register_shortcodes');
    ?>
    Thread Starter chachalady

    (@chachalady)

    I find out this:
    “Replacing echo with return doesn’t work because function is immediately terminated once it hits a return.”

    I thought it must be something I still didn’t learn … So I need help with syntax and coding – how to convert the echo into return.
    I got three echos … On various forum topics I saw that I have to replace all the echo statements with a variable like $stringreturn, then return that variable.
    I am not quite sure how – tried out something already but I guess I made some stupid mistake again…please help

    Thread Starter chachalady

    (@chachalady)

    It seems no one will answer this – I did not marked this topic as resolved (since it isn’t … I still don’t know what went wrong back then ..now it is ok although I didn’t do anything at all…).

    FOR MODERATORS: ( if you are reading this) you can delete this topic if you think it has been to long without answer.
    Thanks.

    I have the same problem,
    I didn’t even try plugins yet cause I think if the button doesn’t work when I add code manually it will not work within plugin also.
    I just wanted to let you know that if I find a solution that works I will let you know (post it here).
    I found some new advices and “how to” add the code I will try …

    Also, most plugins for social bar have problems with new wordpress, 3.5.

    In the meantime, did you find a solution that works? Or the reason why it won’t work …
    It would be a great help if you did.
    Thanks.

    Related to this topic, I am confused:
    – I was struggeling to get /%postname%/ structure to work and IT IS WORKING now , I put the htaccess file in the place it should be
    – so permalinks are working, posts and pages opening but nevertheless I STILL got that message “if your htaccess were file writeable we could do this automatically” at bottom of screen in permalinks under General settings.

    How can that be? Will I have troubles with wordpress (plugins) if I just leave it this way?
    Or should I solve that before I continue with my work on that site …

    Thread Starter chachalady

    (@chachalady)

    UPDATE2: after I was sooooooo confused reading the codex and forums (it is so hard to find some informations for beginers…) I find something that helped me formulated and write the code.
    So this is working for me now:

    First loop on my page where I display posts from ‘akcije-novosti’:

    <?php
          // Create empty array to store post ids in
             $excludes = array();
    
                             $args=array(
                             'post_type' => 'products',
    			 'taxonomy'=>'product-category',
    			 'term' => 'akcije-novosti',
                             'post_status' => 'publish',
    			 'order' => 'DESC',
    			 'posts_per_page' => 2
                            );
                            query_posts( $args ); ?>	
    
        <?php while (have_posts()) : the_post(); ?>
    
                 <?php    // Add post to exclude array
    		      $excludes[] = $post->ID; ?>
    
            ...DO STUFF...DISPLAY TITLE, FEATURED IMAGE, EXCERPTS ....
    
      <?php endwhile; ?>

    So now those ids of the two newest posts from ‘akcije-novosti’ are stored in $excludes.

    Now, I have the second loop where I have to display posts from ‘usluge-proizvodi’ and exclude ids I stored in $excludes :

    <?php
             $args=array(
                   'post_type' => 'products',
    	       'taxonomy'=>'product-category',
                   'term' => 'usluge-proizvodi',
    	       'post__not_in' => $excludes,
                   'post_status' => 'publish',
                   'posts_per_page' => 8
                          );
              query_posts( $args ); ?>	
    
    <?php while (have_posts()) : the_post(); ?>
    
    ...DO STUFF...DISPLAY TITLE, FEATURED IMAGE, EXCERPTS ....
    
    <?php endwhile; ?>

    And it seems to work fine !!!!! ??
    So as you can see I just needed to learn how to make that array with ids and use it …
    Hope this code will help someone.
    Please give me a feedback or post reply or send me a message if you have something to add, and you think it is important.
    I will leave this topic open for a little while then will mark this as resolved.

    Thread Starter chachalady

    (@chachalady)

    UPDATE:
    I add this line : ‘post__not_in’ => array(330,341),
    to exclude posts by their ID:

    <?php
             $args=array(
                   'post_type' => 'products',
    	       'taxonomy'=>'product-category',
                   'term' => 'usluge-proizvodi',
    	       'post__not_in' => array(330,341),
                   'post_status' => 'publish',
                   'posts_per_page' => 8
                          );
              query_posts( $args ); ?>	
    
    <?php while (have_posts()) : the_post(); ?>

    And it is working ok, those two posts are excluded.
    ( I thought post__not_in will not work with custom post type but it’s working… )

    I need to create an array of posts ids so I dont have to add the id manually each time new post is written in ‘akcije-novosti’.
    Need help with writing the code – there has to be a query/loop ? that goes through posts from ‘akcije-novosti’ and collect their id, right?

    After we create that array we can use it to exclude those ids in that line ‘post__not_in’ => array(..list of id…), I just need a little help with code, please …

    Thread Starter chachalady

    (@chachalady)

    We can now mark this as resolved ??

    Thread Starter chachalady

    (@chachalady)

    OMG, yes, that’s the actual code … with ‘category__not_in’ both examples are working ok.
    :-))))

    Thank you very much – how silly of me – I didn’t even realise the diffeence…. !

    Browsing through forums I am sure I saw ‘cat__not_in’ … so I thought I can write it that way …

    All in all – now everybody can see both examples of excluding posts from specific category.

    ??

    Thread Starter chachalady

    (@chachalady)

    Anyone?

    Thread Starter chachalady

    (@chachalady)

    While waiting support to answer I have a thought: could it be , maybe, an issue with order of the “$content = str_replace” in my translation?

    Do I need to put specific translation first in order?
    But since the class is ok (class=”wp_wunderground_fog”) I guess translation is ok too… but why, WHY ?!!!, the wrong icon is displayed?

    Makes me crazy cause I saw those icons already been displayed ok, when they should, and now this – no logic at all… any help?

    Thread Starter chachalady

    (@chachalady)

    Update: today (monday) the chancerain.gif displays ok, with the “chance of rain” forecast cndition.
    BUT there is another issue: this time, for the wednesday the condition is “fog” but the icon used is “partlycloudy.gif”
    I display forecast three days in a row, and sometimes icons are ok sometimes not – I can not see the logic of it.
    Does anyone have any idea how to fix that? Anybody else having the same problem?

    Thread Starter chachalady

    (@chachalady)

    Thank you. I am doing exactly that – testing. Looking ok so far.

Viewing 14 replies - 16 through 29 (of 29 total)