I develop my plugin with this code :  function my_function( $atts ) {     some code } add_shortcode( 'myfunction_shortcode', 'my_function' );   I need to use my shortcode on my page or post, when I used it output code shown on top of my page.
The shortcode produced by this function - a list of all sites in a multisite - outputs above the content in the loop, no matter where it is placed in the editor.  I've looked at the other related questions and answers on WPSE and realize that it has to do with the function using echo instead of return, but it's not as easy as replacing the instances of echo with return in the function below. Or adding echo=0 with a WP function like wp_list_pages()  Any ideas? Where is the function that needs to be returned instead of echoed?  // Output a single menu item function projects_menu_entry($id, $title, $link_self) {     global $blog_id;     if ($link_self || $id != $blog_id) {         echo '&lt;li&gt;';         if ($id == $blog_id) {             echo '&lt;strong&gt;';         }         $url = get_home_url($id);         if (substr($url, -1) != '/') {             // Note: I added a "/" to the end of the URL because WordPress             // wasn't doing that automatically in v3.0.4             $url .= '/';         }         echo '&lt;a href="' . $url . '"&gt;' . $title . '&lt;/a&gt;';         if ($id == $blog_id) {             echo '&lt;/strong&gt;';         }         echo '&lt;/li&gt;';     } }  // Output the whole menu // If $link_self is false, skip the current site - used to display the menu on the homepage function projects_menu($link_self = true) {     global $wpdb;      echo '&lt;ul&gt;';      projects_menu_entry(1, 'Home', $link_self);      $blogs = $wpdb-&gt;get_results("         SELECT blog_id         FROM {$wpdb-&gt;blogs}         WHERE site_id = '{$wpdb-&gt;siteid}'         AND spam = '0'         AND deleted = '0'         AND archived = '0'         AND blog_id != 1     ");      $sites = array();     foreach ($blogs as $blog) {         $sites[$blog-&gt;blog_id] = get_blog_option($blog-&gt;blog_id, 'blogname');     }      natsort($sites);     foreach ($sites as $blog_id =&gt; $blog_title) {         projects_menu_entry($blog_id, $blog_title, $link_self);     }     echo '&lt;/ul&gt;'; }  // Adds a [bloglist] shortcode  function bloglist_shortcode($atts) {     projects_menu(false); }  add_shortcode('bloglist', 'bloglist_shortcode');
Margin top in inline element I may not be coming in tomorrow...    I might not be coming in tomorrow...       When should I use "may" and "might"? Why use iterators instead of array indices? Take the following two lines of code:  for (int i = 0; i &lt; some_vector.size(); i++) {     //do stuff }   And this:  for (some_iterator = some_vector.begin(); some_iterator != some_vector.end();     some_iterator++) {     //do stuff }   I'm told that the second way is preferred. Why exactly is this? Is there a reliable way to determine the OS upgrade history leading to Windows 10 or if it was a fresh install? Local timezones on servers considered harmful? I'm curious as to what other administrators' experiences with timezones, in the context of remotely administered servers, are. In my career I've come across several conventions;   Always, always, always use UTC.   Always, always, always use the timezone of wherever base HQ is. Use the local time of the people who happen to be administering.  Use the local time of the server location.    In some places, I've come across multiple and conflicting conventions. My own preference has been to use UTC, always - with no daylight savings. But for one reason or another, it seems that most people prefer to use some concept of local time, with daylight savings. Although it seems like a straightforward technical matter, discussions around changing conventions always seem to trend towards religious schisms.  What are you using? What do you consider to be the advantages and disadvantages of each approach? A question here on meta for instance may stick around for quite a while. A feature-request  maybe even for months. Then the status (tags) gets changed to  or  or whatever and the OP does not get notified.  On a normal post-edit we get a notification but retagging does not count for that. Please add retagging to the edit notifications. Community user id interpreted by absolute value in search Prove that if $g^2=e$ for all $g$ in $G$ then $G$ is Abelian. How do I start skype in the system tray? proof detail concerning bijection between a set and its power set Theorem: If $X$ is a set, then $X$ is not equivalent to its power set.  Proof: suppose for a contradiction that $f:X\to P(X)$ is a bijection. Define $B:=\{x \in X, x\not\in f(x)\}$. Because $f$ is surjective (onto), there is a $b$ in $X$ with $B=f(b)$. Now $b$ in $B$ would imply $b$ in $B=f(b)$. By definition of $B$, this would mean that $b$ is not an element of $f(b)=B$. Thus we infer $b$ is not an element of $B$. But then $b$ is not an element of $B=f(b)$, which by definition of $B$ forces $b$ in $B$, a contradiction.  I understood this proof until he reached the part that says "Now $b$ in $B$ would imply $b$ in $B=f(b)$..."  This seems problematic to me because the assumption $b$ in $B$ seems unwarranted. Since $B$ is a subset of $X$ it makes sense if we had $b$ in $B$ and then arrived at $b$ in $X$ but the reverse does not seem like a valid step and I'm left wondering if the resulting contradiction that arised came simply from the assumption $b$ is in $B$ and therefore only means that $b$ is not not an element of $B$, And that this has no bearing on the bijection part of the argument. In fact I dont even see how this connects to the part of the argument that used the onto property of bijectiveness. What does 2>/dev/null mean? I would like a brief explanation of the following command line:  grep -i 'abc' content 2&gt;/dev/null A composition of a periodic function that is somehow not periodic. Updated title of arxiv not recognised by Google Scholar? I submitted a paper to a journal and one of the referees suggested to slightly change the title of the paper. The paper was already posted on arxiv. I have updated the paper on arxiv after the revision, but this update is not recognised by Google Scholar. The main problem with this is that Google Scholar is not detecting the new citations to the arxiv paper since the new citations use the new title.  Any suggestions on how to solve this issue?  Update: I updated the arxiv version 2 months ago but Google Scholar does not detect it. It detects new papers that cite my manuscript, but not the updated arxiv.  Disclaimer. I am aware of the following questions, but they are related to different issues. How do we get Community Promotion Ads on beta sites? All the launched sites get Community Promotion Ads meta posts posted every year by a SE mod.  Previously, I thought that beta sites simply weren't allowed them. However,  is still in beta, and they had community promotions meta posts in  and  (I guess they haven't made one for 2015 yet).  So what happens? Do you just have to ask for one? Can the moderators of that site just create one as they like? Can anyone on that site just create one as they like? Quantum mechanics textbooks that use path integrals I'm looking for a textbook in quantum mechanics that relies heavily on Green functions and the path integral formalism to supplement my QM books. I want to do some calculations using alternative methods (path integrals, green functions, Lagrangians etc). When Ron broke his wand, why didn't he apply for Hogwarts financial aid? Possible Duplicate:          I got two answers for the same question from different users and both of them correct and working perfectly, but I am unable to accept both of them. Why? There may be some questions that can be answered in several ways, but I can't here in Stack Overflow. Why? I am trying to write a VF page to list all the id and name columns from a custom object but found an error "List has more than 1 row" in the VF page.  Can anyone tell me what have I done wrong?  VF Page:  &lt;apex:page Controller="MP_controller" showHeader="false" sidebar="false"&gt;   &lt;apex:pageBlock&gt;      &lt;apex:pageBlockTable value="{! mp}" var="item"&gt;         &lt;apex:column value="{! item.id}"/&gt;         &lt;apex:column value="{! item.name}"/&gt;       &lt;/apex:pageBlockTable&gt;   &lt;/apex:pageBlock&gt; &lt;/apex:page&gt;   Apex controller  global with sharing class MP_controller {     public Merchant_Profile__c mp{get;set;}     public MP_controller(){         mp = [SELECT                  ID, name, Profile_account_name__c, Merchant_ID__c, Bank_Code__c, Country_Code__c,                 Currency_Code__c, Merchant_Level__c, Merchant_Type__c, MSO__c, Region__c,                 Retail_Products__c, Transaction_Mode__c, Created_Date__c, Date_Disabled__c, Date_Live__c,                 Merchant_Category_Code__c                FROM Merchant_Profile__c               WHERE Profile_Account_Name__c = '001O000000bQFnyIAG'];     } } Change Shapefile data source encoding? I tried to change the only the shapefile datasource encoding through properties and also  but it doesn't change it.   Without saving the QGIS project can't I directly change the shapefile datasource encoding?  I also tried this code, it shows change encoding but as I open the shapefile again it show the same old system encoding:  for layer in QgsMapLayerRegistry.instance().mapLayers().values():     layer.setProviderEncoding(u'UTF-8')     layer.dataProvider().setEncoding(u'UTF-8')     print layer.name(), layer.dataProvider().encoding()     (I am not saving QGIS project, just accessing and saving shapefile directly. When I save the project and do this task then it work correctly) I'm a bit confused on how extra damage works for critical hits. Let's take the following example: A thief with sneak attack rolls a crit. I'm under the impression he rolls double his normal attack damage dice AND double his Sneak Attack damage dice. Is this accurate? Another example, I finished DM-ing my first campaign recently. The Giant Spider enemy monster has an melee attack that causes a constitution saving throw. If the player fails, the enemy rolls an additional 2D8 of damage. In this situation, if there was a critical hit, and the player failed their saving throw, would I also roll double dice on the additional damage? Or is that considered a separate attack?