Posts by LovelessDesign

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

Thanks. That helped :)

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

Hello I would need a php syntax expert for a short question.

It’s in the WooCommerce Plugin. There are product attributes which all have an ATTRIBUTE NAME and a VALUE. Every value is divided by comma. Now, I want to just add Links to every by comma divided value.

This line is at the bottom in product-attributes.php:

echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );

Every Value should have a link to a glossar, for example the value “Game” should have a link like http://xxx.com/glossar#game>

echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( '<a href="http://xxx.com/glossar#game">'.implode( '</a>, <a href="http://xxx.com/glossar#game">', $values ).'</a>' ) ), $attribute, $values );

How can I change it so that the word “game” in the link is always the actual value? It doesn’t work with something like $values or $values0

Would be great if someone could help

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

Thanks a lot sevenspark. You have perfectly identified my problem again and gave me the perfect solution. Great. :)

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

@sevenspark: so I should store the $team1res in a metafield. That was my idea too but how can I store it as a metafield? Doesn’t the user who vote has to be admin? I just know the other way when I type, as an admin, type something in a metafield and get the variable in the php code.

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

Hey,

I haven’t found a solution with google. I have a loop that I want to sort with a sql table. The posts that have the most entries in my own sql-table, should be shown first.

Do you have an idea how to realize that?

$args = array(
    'paged'    => $paged,
    'cat'         => $catfilter,
);
if ($blogposts->have_posts()) :
   while ($blogposts->have_posts()) : $blogposts->the_post(); 

      $pageid = get_the_ID();
      $team1res = $wpdb->get_var("SELECT COUNT(*) FROM wp_votelock WHERE page_id=$pageid AND team=1");
145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

I need the each function cause there are more than one ld-container. I just need a way that the each function runs on page load but not if a button is pressed (when the button is pressed, the page doesn’t load again because there are ajax function but the each function is loaded again)

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

I have two jquery functions in a js file. The Problem is that if I click one of the Submit Buttons, the each function AND the click function run. But I want the each function to only run on page load (not on the click of a submit button). If a Submit button is clicked, only the click function should run.

$(document).ready(function() {
    $( '.ld-container' ).each( function(){
        var obj = new CAjaxLikes( this ); 
        obj.run();
    });
    $( '.ld-container .button' ).click( function(){
        var obj = new CAjaxLikes( this ); 
        obj.run();
        return false
    });
});

The HTML:

<div class="ld-container" tid="'.$tidcalc.'" buttonclick="no" userid=".$userid." pageid=".$pageid." action="http://xxx.de/poll/ajax_likes.php">

<form>
    <input type="submit" class="button ld-btn-like" title="Kontrahent 1" value="'.$team1.'" tid="'.$tidcalc.'" buttonclick="yes" userid='.$userid.' pageid='.$pageid.' team=1 action="http://xxx.de/poll/ajax_likes.php">
    <span class="jetztabstimmen">Jetzt abstimmen</span>
    <input type="submit" class="button ld-btn-dislike" title="Kontrahent 2" value="'.$team2.'" tid="'.$tidcalc.'" buttonclick="yes" userid='.$userid.' pageid='.$pageid.' team=2 action="http://xxx.de/poll/ajax_likes.php">
</form>

</div>
145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

Hello.

Short question. Is it ok (according to page and server load) to have one mysql query per blog post, also on blog overview pages with 10 posts?

It would be always a table with a few thousand rows and the query is looking for a specific entry. On the blog overview pages there are 10 (or even 20) queries per page. Is this acceptabel for page/server load?

thank you

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

Maybe it’s not the best solutions with the action attribute in the div and in the buttons. But the plugin was built in that way and I don’t want to change it if not necessary.

So is there a way to don’t run the each function when a submit buttpn is clicked?

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

I’ve Finally Found the error! It had to be ($einlesen,0)<0) instead of ($einlesen,0)<1)

Now, I have another question (jquery). I have two jquery functions .

$(document).ready(function() {
    $( '.ld-container' ).each( function(){
        var buttonclick = 'no';
        var voteaccepted = 'yes';
        var obj = new CAjaxLikes( this,buttonclick,voteaccepted ); 
        obj.run();
    });
    $( '.ld-container .button' ).click( function(){
        var buttonclick = 'yes';
        var voteaccepted = 'yes';
        var obj = new CAjaxLikes( this,buttonclick,voteaccepted ); 
        obj.run();
    });
});

The Problem is that if I click one of the Submit Buttons, the each function AND the click function run.

But I want the each function to only run on page load. If a Submit button is clicked, only the click function should run. This is the HTML:

<div class="ld-container" tid="demo4" userid="<?php" echo=""> pageid=<?php the_ID(); ?> action='http://xxx.de/poll/ajax_likes.php'>

<form>
    <input type="submit" class='button ld-btn-like' title='Kontrahent 1' value='<?php echo $team1; ?>' tid='demo4' userid=<?php echo $userid; ?> pageid=<?php the_ID(); ?> team=1 action='http://xxx.de/poll/ajax_likes.php'>

    <span class="jetztabstimmen">Jetzt abstimmen</span>

    <input type="submit" class='button ld-btn-dislike' title='Kontrahent 2' value='<?php echo $team2; ?>' tid='demo4' userid=<?php echo $userid; ?> pageid=<?php the_ID(); ?> team=2 action='http://xxx.de/poll/ajax_likes.php'>
</form></div>
by
by
by
by
by
by