logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

This member supports the community by voting at least twice a month. This member is one of our top experts of the month. This member is one of the top experts of all time, the true elite. Dbranes

Bio:

Developer from Iceland

... Just another Earthling cruising the Milky Way galaxy ...

Answers Given: 363 (see them all)
Contests Won: 210
Prize Money Earned: $3033
Questions asked: 0
Questions refunded: 0 (see all?)
Is a top asker (has the power to vote on anything):
Subscribes to all the discourse posted to the site?: Yes
Country: iceland
City: reykjavik
Netvotes this month (upvotes minus downvotes): 2
Netvotes of all time (upvotes minus downvotes): 19
Joined the site: July 16, 2012





Dbranes 's upvoted answers:






This member has no downvoted answers






Answers given to these questions:

See more?






Questions voted:

The community is grateful to those experts who take the time to vote on questions.

See more?






Dbranes has not asked any questions






This member has not made any recommendations. If you are one of the top experts, please offer one now!






Dbranes 's discourse:

Written in response to Video + Media pop ups not working:

Hi Emilia, I can't reply once the question is completed, so let me add this discourse:

It should be ok as it is, since you're not using a child theme.

The function you're using is actually returning get_template_directory_uri().

Best regards.

link

Written in response to Auto expire posts in Event Calendar Pro:

Sorry to say, but I would have to downvote the asker, if it were possible,
because he only wants to work with one expert from this site and isn't responding to any good answers given by other experts.

I just watch the other experts wasting their time trying to answer his questions.

I'm sure all the questions were solved in a great way, but visitors to this site,
looking for solutions to similar questions, have no clue how the questions were solved.

I wonder why the asker is using this site, instead of hiring the expert directly?

This kind of extended/established client relationship, seems unfair to other experts.

So one suggestion to the asker:

Maybe label future questions with the name of the chosen expert.


This is my opinion ;-)

link

Written in response to Internal link:

Please write in English so everybody can follow.

According to FAQ #25:

What language do we use here?
Polite language, please. More specifically, the language of this site is English. If you prefer to converse in another language, please do so through personal messages.


Thanks ;-)

link

Congratulation to Arnav Joy for reaching the amazing $5k in total prize earnings ;-)

Well done and keep up the good work.

cheers

link

Arnav Joy had responses to this.

Written in response to Modify Gallery Shortcode to open large images instead of full:

Hi, here is just another solved question according to the asker but without a vote:

http://wpquestions.com/question/showChrono/id/8562

It would be great if you would consider voting on it, thanks.

cheers

link

Written in response to change result of update_post_meta in database:

Saving a meta value array like this one:

array( 19 => array( "enabled", "true", "rate", "30") )


will give you the serialized string:

 a:1:{i:19;a:4:{i:0;s:7:"enabled";i:1;s:4:"true";i:2;s:4:"rate";i:3;s:2:"30";}}


but not the non-valid serialized string:

a:1:{i:19;a:2:{s:7:"enabled";s:4:"true";s:4:"rate";s:2:"30";}}


you wanted (hence the reason for custom SQL update query).

cheers

link

Hi, just few things I've noticed:

1) new question emails where not sent during the weekend.
2) what is the status of the: "On the 1st of each month, a prize is given to the most upvoted expert."
3) the upvoted discourse list is filled with spam.
4) is the community pot paid out every night? It reads: "Every night we pay out a portion of the Community Pot (5% or $25, whichever is greatest)."
5) I think too many solved problems are going to the community pot, is there a way to remind askers to vote?
6) I think it would be nice to have each question/answer/response linkable.

ps: thanks again for this great site and community service ;-)

cheers

link

One idea:

It would be nice to have each answer/response linkable i.e. where this kind of url:

http://www.wpquestions.com/question/showChronoLoggedIn/id/8039#123456


would take you to the corresponding answer/response.

cheers.

link

Written in response to something Lawrence Krubner wrote.

good idea ;-)

ps: I have noticed that the netvotes (on the user profile pages) are off by +1 or -1 for some users, i.e. if we use this definition:

Netvotes of all time (upvotes minus downvotes):


Here are some examples:

  http://www.wpquestions.com/user/profile/id/7063

13 upvotes - 6 downvotes = 7 netvotes (but reports 6 netvotes)

---

http://www.wpquestions.com/user/profile/id/8523

6 upvotes - 0 downvotes = 6 netvotes (but reports 5 netvotes)

---
http://www.wpquestions.com/user/profile/id/2974

1 upvotes - 0 downvotes = 1 netvote (but reports 2 netvotes)



---

... or maybe I'm just misunderstanding the netvotes ;-)

cheers

link

Written in response to something Dbranes wrote.


Harish Chouhan says:
Hello,
Just another related question about JS, but i understand if its not possible to answer.

I wish to give the download link from say www.website.com/theme_01/

Now when the user clicks on the download link on the above example page, it either starts the download or if it fails, should show a javascript alert box. But the user should continue to stay on www.website.com/theme_01/. is this possible?


you could replace
echo "<h1>Sorry, no access!</h1>";

with
wp_redirect( 'http://www.website.com/theme_01/', 301 );


or hide the links for non authorized users.

link

Written in response to Protecting File Downloads in WordPress based on user role:

Harish Chouhan says:
I have voted your answer, but not sure if you got the funds or if I need to do anything else. Please advise.


perfect, thanks

(the thread is closed when the question is in voting)

link

Dbranes had responses to this.

Written in response to something Anthony Moore wrote.

> Is it possible to store all of the taxonomy terms in an array and then just have for my tax query
>
> 'taxonomy' => 'celebrity_types',
> 'terms' => array($term_list),
>
> would something like that be possible?

yes, if the terms are not too many, you could try

 'tax_query' => array(
array(
'taxonomy' => 'celebrity_types',
'field' => 'slug',
'terms' => $celebrity_slugs,
'operator' => 'IN',
)
)


where you have

$celebrity_terms = get_terms('celebrity_types', 'hide_empty=1');
$celebrity_slugs = array();
foreach ( $celebrity_terms as $term ) {
$celebrity_slugs[]=$term->slug;
}


cheers.

link

Anthony Moore had responses to this.

Written in response to Display all Posts from Taxononmy with Pagination:

> Anthony Moore wrote:
> I just realized that the page is displaying ALL of the posts and not just the ones with a term in the "celebrities" taxonomy.
> I guess "taxonomy_name" doesn't do anything. These is my args
> Any suggestions?

Hi Anthony, I can't reply on the completed question (closed for comments):

http://www.wpquestions.com/question/showChronoLoggedIn/id/7681

You are right, I just checked out the SQL query behind it.

For example:

                
'taxonomy'=>'celebrity_types',
'taxonomy_name'=>'celebrity_types',
'tax_query' => array(
array(
'taxonomy' => 'celebrity_types',
)
)


does not change the query at all.

There are few alternative ideas that come to mind:

1) if the terms are not many, you can list them like this:


'tax_query' => array(
array(
'taxonomy' => 'celebrity_types',
'field' => 'slug',
'terms' => array('type_a','type_b','type_c'),
'operator' => 'IN',
)
)


2) you can have one term (fx. "all") that all "speakers" posts are marked with, if they are in the celebrity_types taxonomy, then you can use

                'tax_query' => array(
array(
'taxonomy' => 'celebrity_types',
'field' => 'slug',
'terms' => 'all'
)
)


3) have one term (fx. "exclude") that all speakers posts are marked with if they are NOT in the celebrity_types taxonomy (but then they will be in this taxonomy of coz ;-).

You can then use:


'tax_query' => array(
array(
'taxonomy' => 'celebrity_types',
'field' => 'slug',
'terms' => array('exclude'),
'operator' => 'NOT IN',
)
)


4) use custom SQL queries like this one:
(to search for all posts in the "speakers" post_type that are also in the "celebrity_types" taxonomy)

$sql=" SELECT
{$wpdb->term_relationships}.object_id as post_id,
{$wpdb->posts}.post_title as post_title,
{$wpdb->terms}.name as term_name,
{$wpdb->term_taxonomy}.term_id as term_id,
{$wpdb->term_taxonomy}.taxonomy,
{$wpdb->terms}.slug as term_slug,
{$wpdb->posts}.post_name
FROM {$wpdb->terms}
LEFT JOIN {$wpdb->term_taxonomy}
ON {$wpdb->term_taxonomy}.term_id = {$wpdb->terms}.term_id
LEFT JOIN {$wpdb->term_relationships}
ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id
LEFT JOIN {$wpdb->posts}
ON {$wpdb->term_relationships}.object_id = {$wpdb->posts}.id
WHERE {$wpdb->term_taxonomy}.taxonomy in ( 'celebrity_types')
AND {$wpdb->posts}.post_status ='publish'
AND {$wpdb->posts}.post_type ='speakers'
GROUP BY post_id LIMIT 0,6
";

$data =$wpdb->get_results($sql,ARRAY_A);

// debug:
// echo "count: ".count($data);
// print_r($data);

foreach($data as $d){
echo "<div>";
echo "<h2>".$d['post_title']."</h2>";
echo $d['post_name'];
echo "</div>";
}


but this is the most complex method and will need some more programming to link fx. $paged with the "LIMIT" part of the query.

You would also have to change the pagination and next/prev links.

cheers.

link

Anthony Moore had responses to this.

Written in response to something Martin Pham wrote.


nice answer you provided by the way, it's not very often we see linux shell commands popup in the answers here ;-)

- it would be interesting to have linuxquestions.com ;-)

cheers

link

Written in response to Access denied.:

ps: just be careful using this kind of permission:

chmod 777 /homepages/25/d161120255/htdocs/rockwell/wp-config.php


the wp-config.php file should in general not have a 777 permission, since it contains the database password etc.

See more here:

http://codex.wordpress.org/Changing_File_Permissions

wp-config.php should be 600 to prevent other users on the server from reading it.


cheers

link

Martin Pham had responses to this.

Written in response to something Basilis Kanonidis wrote.

Basilis Kanonidis: you can read more about the voting here:

http://blog.tailormadeanswers.com/2011/04/22/voting-assign-prize-money/

cheers

link

First I want to thank Lawrence and the WP Questions community for a great site ;-)

---

I'm sometimes contacted by askers who are not able to vote on the questions.

I haven't been an asker before, so I can't advice them.

---

The link "Tutorial: How to assign prize money" given in the footer is

http://codewi.se/2011/04/22/voting-assign-prize-money/

it's in Swedish and about something quite different ;-)

This link is also given in the FAQ (term 29).

---

cheers




link

Written in response to something John Cotton wrote.

John has got a point there.

ps: I was courious why the other solutions didn't work, so I found out why:

a) there was a tiny misspell in Keith Donegan's solution, there was a missing "t" in the $ouput variable name (should have been $output)

b) and I forgot to put $post->ID inside get_the_title(), but I don't like query_posts for various reasons so I used get_posts instead.


So here are the two corrected solutions just for referance:

Keith Donegan's solution

add_shortcode('random_quotes', 'my_random_quotes');
function my_random_quotes(){
$output = '';
//The Query
query_posts('post_type=client-quotes&posts_per_page=1&orderby=rand');
//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
$output .= '<h3>' . get_the_title() . '</h3>';
$output .= '<p class="name"><a title="Testimonials from our clients" href="/testimonials-from-our-clients/">...read more</a></p>';
endwhile; else:
endif;
//Reset Query
wp_reset_query();
return $output;
}


Dbrane's solution

//add_shortcode('random_quotes', 'my_random_quotes');
function my_random_quotes(){
$s="";
$posts=get_posts(array( 'post_type'=>'post','numberposts' =>1,'orderby'=>'rand'));
foreach( $posts as $post ){
setup_postdata($post);
$s.="<h3>".get_the_title($post->ID)."</h3>";
$s.='<p class="name"><a title="Testimonials from our clients" href="/testimonials-from-our-clients/">...read more</a></p>';
}
}

link

Written in response to something John Cotton wrote.

John has got a point there.

ps: I was courious why the other solutions didn't work, so I found out why:

a) there was a tiny misspell in Keith Donegan's solution, there was a missing "t" in the $ouput variable name (should have been $output)

b) and I forgot to put $post->ID inside get_the_title(), but I don't like query_posts for various reasons so I used get_posts instead.


So here are the two corrected solutions just for referance:

Keith Donegan's solution

add_shortcode('random_quotes', 'my_random_quotes');
function my_random_quotes(){
$output = '';
//The Query
query_posts('post_type=client-quotes&posts_per_page=1&orderby=rand');
//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
$output .= '<h3>' . get_the_title() . '</h3>';
$output .= '<p class="name"><a title="Testimonials from our clients" href="/testimonials-from-our-clients/">...read more</a></p>';
endwhile; else:
endif;
//Reset Query
wp_reset_query();
return $output;
}


Dbrane's solution

//add_shortcode('random_quotes', 'my_random_quotes');
function my_random_quotes(){
$s="";
$posts=get_posts(array( 'post_type'=>'post','numberposts' =>2,'orderby'=>'rand'));
foreach( $posts as $post ){
setup_postdata($post);
$s.="<h3>".get_the_title($post->ID)."</h3>";
$s.='<p class="name"><a title="Testimonials from our clients" href="/testimonials-from-our-clients/">...read more</a></p>';
}
}

link

Written in response to Gravity Form and NextGEN Gallery:

It would be interesting to hear what the problem was - thanks.

link

Arnav Joy had responses to this.

See more?






Dbranes has not had any questions refunded






Dbranes suggested these prizes as appropriate for these questions:

See more?