echo or return? [duplicate]

Functions can only return one value. Change all the echo statements in your tweet function to concatenate a string, then return the string at the end of the function.

Open all external links in new window – need help with the code

Way to complicated to do this with php in WordPress, I’d advice on doing this on the frontend with a bit of jquery magic. I wrote a tiny jQuery plugin that opens all external links (all links with another domain/host name than the current site) in a new window. Check out the plugin: https://www.npmjs.com/package/jquery.jold.external-hrefs To … Read more

Show page title just from the first child-page in template

Use WP_Query class to do it: $the_query = new WP_Query( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ‘posts_per_page’ => 1, ) ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <h2 class=”subpagetitle”> <a href=”https://wordpress.stackexchange.com/questions/55118/<?php the_permalink(); ?>” rel=”bookmark” title=”<?php the_title(); ?>”> <?php the_title(); ?> </a> </h2> <?php endwhile; // Reset Post Data wp_reset_postdata();

Return $post_id when DOING_AUTOSAVE?

The ‘save_post’ action was added to core in 2.0, and has always been an action. Looking through the current autosave procedures, it doesn’t appear to call the ‘save_post’ action directly at any time. So the short answer is, no. There is no reason, and has never been any reason, to return any value on this … Read more

Filter and Search

I don’t believe there’s anything automatic for what you’re looking for, no. I built a similar functionality for sorting products with dimensions, but this was all custom as I did not find anything that suited my needs. You’d need to look into pre_get_posts using $_GET requests.

CSS Styling for a Page/ Site made with Pagelines

The primary stylesheet for a theme is usually /wp-content/themes/themename/style.css. That would be the first place to look. That file has to exist, but may be mostly empty and other stylesheets can be loaded by both theme and plugin. Some themes have very complicated stylesheet structures. The easiest way to find the stylesheets is with a … Read more