-
AuthorPosts
-
January 3, 2023 at 2:33 pm #1377466
Hi there and all the best in 2023!
I have all my portfolio items/pages password protected. Can I use the advanced layout editor to update the design of the template that’s showing the featured image and the password form in any way? Or if it’s not possible, what php file should I edit and how to replace the featured image with a color section with the featured image as a background image?
Thanks!January 4, 2023 at 8:53 am #1377557Hey sdim,
Thank you for the inquiry.
You cannot modify the password-protected form using the layout editor or builder, but there is an available filter called “the_password_form” that you can use in the functions.php file to adjust the form.
Example:
function avf_custom_password_form() { global $post; $label = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID ); $output = ' <div class="boldgrid-section"> <div class="container"> <form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="form-inline post-password-form" method="post"> <p>' . __( 'This content is password protected. This is a custom message. To view it please enter your password below:' ) . '</p> <label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" class="form-control" /></label><button type="submit" name="Submit" class="button-primary">' . esc_attr_x( 'Enter', 'post password form' ) . '</button> </form> </div> </div>'; return $output; } add_filter('the_password_form', 'avf_custom_password_form', 99);
You may need to add conditions so that above modification will be only applied to portfolio pages.
Best regards,
IsmaelJanuary 4, 2023 at 1:28 pm #1377577Thanks for the reply Ismael!
For the password form that would do but how can I go to the the featured image that’s displayed above the password form and set it as a background image of a color section?January 6, 2023 at 10:27 am #1377803Hi,
You can try this hook in the functions.php file to render a color section in the portfolio page with the featured image as background. Please note that this modification will only work for portfolio items without sidebars.
add_action("ava_after_main_title", function() { $post_id = get_the_ID(); if(get_post_type( $post_id ) == "portfolio") { $thumbnail = get_the_post_thumbnail_url ( $post_id ); echo do_shortcode("[av_section min_height='50' min_height_pc='25' min_height_px='500px' shadow='no-border-styling' bottom_border='no-border-styling' bottom_border_diagonal_color='#333333' bottom_border_diagonal_direction='' bottom_border_style='' padding='default' custom_margin='0px' custom_margin_sync='true' av-desktop-custom_margin='' av-desktop-custom_margin_sync='true' av-medium-custom_margin='' av-medium-custom_margin_sync='true' av-small-custom_margin='' av-small-custom_margin_sync='true' av-mini-custom_margin='' av-mini-custom_margin_sync='true' svg_div_top='' svg_div_top_color='#333333' svg_div_top_width='100' svg_div_top_height='50' svg_div_top_max_height='none' svg_div_top_opacity='' svg_div_bottom='' svg_div_bottom_color='#333333' svg_div_bottom_width='100' svg_div_bottom_height='50' svg_div_bottom_max_height='none' svg_div_bottom_opacity='' color='main_color' background='bg_color' custom_bg='' background_gradient_direction='vertical' background_gradient_color1='#000000' background_gradient_color2='#ffffff' background_gradient_color3='' src='" . $thumbnail . "' attachment='31' attachment_size='full' attach='scroll' position='center center' repeat='stretch' video='' video_ratio='16:9' overlay_opacity='0.5' overlay_color='' overlay_pattern='' overlay_custom_pattern='' custom_arrow_bg='' css_position_z_index='' av-desktop-css_position_z_index='' av-medium-css_position_z_index='' av-small-css_position_z_index='' av-mini-css_position_z_index='' id='' custom_class='' template_class='' aria_label='' av_element_hidden_in_editor='0' av_uid='av-lck8sod6' sc_version='1.0'][/av_section]"); } }, 10, 1);
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.