Create Shortcode shows only posts with custom_field meta

You need your shortcode to accept attributes. A shortcode with attributes would look like: [publication year=”2017″] Then in your add_shortcode callback function you receive attributes in the first parameter of the function: function wpse_279094_publication_shortcode( $atts ) { echo $atts[‘year’]; } add_shortcode( ‘publication’, ‘wpse_279094_shortcode’ ); You want to be able to account for a user not … Read more

Contact form code not working. Need help!

Copied from my Answer for “An old plugin self-made stoped sending mail”: Many E-Mail-Hosters changed their rules to prevent spam. Often times, E-Mails that have one domain name in their “from”-Tag and come from a server with a different domain are rejected. So my guess is, maybe the emails are still sent, but not received. … Read more

Split Content and Gallery

Open to anybody who can simplify this but here’s what I came up with that worked for me. First thing’s first – get the gallery, using get_post_gallery(), as soon as the loop starts: <?php if( have_posts() ) : ?> <?php while( have_posts() ) : the_post(); $gallery = get_post_gallery(); $content = strip_shortcode_gallery( get_the_content() ); ?> <div … Read more

WordPress Shortcode based on other shortcode

Does the TOC need to be a shortcode? Perhaps giving the editors a meta box with a set of radio boxes for none, below and above options would be cleaner? You could then generate the TOC via the static variable approach you mentioned and output it during page render.

Unable to make shortcode, what is wrong?

That simply is too late for a shortcode. Just try putting it in your themes functions.php file. Aside from that, using shortcodes imo are not a good idea. When you decide to change it, it will still stay in the database. This means either going through all places in the DB to clean up the … Read more