Return only certain (html)-elements of the_content()

There are two ways to achieve it. $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’=>1 ); $mj_query = new WP_Query( $args ); By the_expcerpt(), You can use excerpt field to display the content for post listing page.You can enable excerpt field by screen option through current post edit page.Just put html element to that excerpt field … Read more

Populate an array from the loop, and then read the array into JS

It’s because you’re running the localize script inside the loop. Instead, store the array of ids etc, and then run localize script outside/after you set it up. All the localize script really does is inject the params you pass into it into the global scope of js/jquery, allowing you to reference them. However, localize script … Read more

“Page Array” displaying in title bar on Front Page

There are many ways to set page title in wordpress. 1) In admin area go to settings >> General Settings. Set “Site Title” field and “Tagline” field values. 2) You can set your page title using wp_title() function to set the title of your page. Using this function you can change your page title based … Read more

Show content by using tags

in case someone else in searching for this, I used a WP Query with the statement tag: $args = array (myargs1,….,myargsn); for ($i=0; $i<count($args);$i++){ $query = new WP_Query( array( ‘tag’ => $args[$i] ) ); …and so on with if have_posts() and a while loop, you can find the whole syntax on wordpress.org, only thing i … Read more

how to get buddy press messages based on thready_id?

Dig a little deeper into the BP Messages file and you will see that bp_message_thread_content() only outputs the last message in the thread. Similarly with bp_message_thread_subject(). bp_message_thread() sets up the last message data but no other message data. Instead it looks like you want a new class of BP_Messages_Thread_Template to output the messages for the … Read more

Wrapping shortcode content in a span or link

Get out of the switch block before placing the final return statement. if you place return at the end of the switch block that way, the switch block already ends before it gets to the return statement (because of the previous matching break statements). The correct CODE will be: // just in case $summary is … Read more

Strange special character/Latin characters

Still no idea that why and how this happened all of sudden. But here is the 2 Solutions I found which is working: Applying anyone will work 1. Comment these two – //define(‘DB_CHARSET’, ‘utf8’) and //define(‘DB_COLLATE’, ”) 2. Use Latin1, (‘DB_CHARSET’, ‘latin1’) However, I am suspecting some attacks on our sever where blogs are hosted … Read more