code-snippets
code-snippets copied to clipboard
Selecting a specific label
I want to select a label in order to edit / hide its content or just center it (it contains a text and an image).
The label is: < label for=”payment_method_angelleye_ppcp” >
And I tried this in code snippets pro to address / select it, but nothing seems to work:
label[for=payment_method_angelleye_ppcp]
.label[for=payment_method_angelleye_ppcp]
label[for=”payment_method_angelleye_ppcp”]
.label[for=”payment_method_angelleye_ppcp”]
I’m happy for any suggestion or idea.
With kind regards and best wishes for the new year Chris
Hi @chris15326,
Can you provide an example of the full snippet code you are using?
Hey, thanks for coming back to me!
Yes, I basically used what your FAQ gave me as solution: https://help.codesnippets.pro/article/46-how-can-i-make-a-snippet-run-on-only-a-certain-page https://help.codesnippets.pro/article/42-can-i-run-my-snippet-on-just-one-page
For my two PHP snippets:
if ( ! is_page( '/bestellen' ) ) return;
add_action( 'wfacp_internal_css', function () { ?>
<script>
window.addEventListener('load', function () {
(function ($) {
$(document.body).on('click', '.multi-cart-form .button',
function () {
setTimeout(function () {
$(document.body).trigger('update_checkout');
}, 1000);
});
})(jQuery);
});
</script>
<?php } );
if ( ! is_page( '/bestellen' ) ) return;
add_action( 'wp_footer', function () {
?>
<script>
window.addEventListener('load', function () {
(function ($) {
function wfacp_scroll(){
$('html,body').animate({
scrollTop: $('#wfacp-e-form').offset().top
}, 1000);
}
$('#proA').on('click', function (e) {
e.preventDefault();
$('.wfacp_switcher_checkbox').eq(1).click();
wfacp_scroll();
});
$('#proB').on('click', function (e) {
e.preventDefault();
$('.wfacp_switcher_checkbox').eq(0).click();
wfacp_scroll();
});
$('#proC').on('click', function (e) {
e.preventDefault();
$('.wfacp_switcher_checkbox').eq(2).click();
wfacp_scroll();
});
})(jQuery);
});
</script>
<?php
} );
And for my CSS snippet:
add_action( 'wp_head', function () {
if ( ! is_page( [ 'Bestellen' ] ) ) { return; }
?>
On Sat, Feb 25, 2023 at 3:41 AM Shea Bunge @.***> wrote:
Hi @chris15326 https://github.com/chris15326,
Can you provide an example of the full snippet code you are using?
— Reply to this email directly, view it on GitHub https://github.com/codesnippetspro/code-snippets/issues/161#issuecomment-1444958754, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5C3DKRJ7FVYSA5TW3HWISTWZFWOHANCNFSM6AAAAAATRUWIZE . You are receiving this because you were mentioned.Message ID: @.***>