Overriding Generated Attachment Post URL
Overriding Generated Attachment Post URL
Overriding Generated Attachment Post URL
This plugin creates custom links to attachments links so this way its possible to set expiry date, permissions etc. I would suggest you to look at the plugin code, adapt the parts that you looking to custom and add your code. This may save you the time finding and testing the attachments hooks and filters.
Custom permalink for attachment
I’d do it like this: (see the // comment here in the code) // Wrap the AJAX call to `test_function` in a `function`. function ajaxTestFunction( page_num ) { if (jQuery(‘#telegram_chk’).is(“:checked”)) var telegram=””; else var telegram=”facebook”; if (jQuery(‘#twitter_chk’).is(“:checked”)) var twitter=””; else var twitter=”twitter”; if (jQuery(‘#eth_chk’).is(“:checked”)) var eth=””; else var eth=”ethereum”; if (jQuery(‘#xml_chk’).is(“:checked”)) var xml=””; else var … Read more
And why should it work? parse_query is an action, not a filter. This action takes $query (WP_Query object) as argument and lets you modify it. Now, take a look at your code if slug equals 3: $sql12 = “SELECT * FROM wp_posts WHERE ID IN(SELECT post_id FROM wp_postmeta WHERE meta_key=’userlimit’ and meta_value > 0)”; $results … Read more
That turned out to be the issue: My callback was running, it just was not able to insert headers. (thanks, both of you)
It’s a very broad question, but my approach would look something like this: I’d replace your code with this: <?php my_the_payment_options(); ?> And then in my plugin: function my_the_payment_options() { $payment_options = get_my_available_payment_options(); if ( $payment_options ) : ?> <div class=”payments-options”> <?php foreach ( $payment_options as $k => $v ) call_user_func( $v[‘callback’] ); ?> </div> … Read more
Use add_filter inside another function
If your theme adheres to WordPress standards the menu is generated with a call to wp_nav_menu. This function has a filter that allows you to modify the html. Like this: add_filter (‘wp_nav_menu’, ‘wpse312466_add_loginlink’); function wpse312466_add_loginlink ($nav_menu, $args) { $nav_menu = ‘<div id=”loglink”><a href=”https://wordpress.stackexchange.com/link/to/loginpage”>Login here</a></div>’ . $nav_link return $nav_menu } Now it depends on your css … Read more
adding an action inside if condition not working