Retrieve content of page by URL Parameter

There is a way, simply register your query: function my_query($vars) { return array(‘your_query’) + $vars; } add_filter(‘query_vars’, ‘my_query’); And get custom template the query exists (here /?your_query=first gets template called custom_template.php from your theme folder. function my_query_template($template) { global $wp; if ($wp->query_vars[‘your_query’]==’first’) { return dirname( __FILE__ ) . ‘/custom_template.php’; } else { return $template; } … Read more

How can I extract or parse data from post contents’ shortcodes into an array?

Not really a WordPress question, but you can use the PHP function preg_match_all to extract all the text wrapped in [cs_text] tags like so: function wpse_265295_extract_cs_text( $subject ) { $pattern = “#\[cs_text\](.*?)\[/cs_text\]#s”; preg_match_all( $pattern, $subject, $matches ); return isset( $matches[1] ) ? $matches[1] : []; } If you’re looking to extract arbitrary shortcodes: if( ! … Read more

Displaying Post Content on tooltip

The problem is that your template doesn’t have any quotes around the title attribute at all: title=<?php echo get_the_content(‘post_content’, $post->ID); ?> So the browser’s making its best guess and using the first word. So you need to add the quotes: title=”<?php echo get_the_content(‘post_content’, $post->ID); ?>” Also, if you’re outputting arbitrary content into an attribute you … Read more

Media is not showing on post page

You can either choose a theme that already shows full posts on Categories by default, or you can create a child theme: Create a new folder under /wp-content/themes/ – the name is up to you, but for simplicity’s sake, you may just want to call it themename-child. So if you’re using the “twentysixteen” theme, call … Read more