Storm Rockwell
Forum Replies Created
-
I believe the standard for JSON LD is in the head tag but if u want it in the body below the content just change wp_head to wp_footer
@xroox sure,
include get_template_directory() . '/page.php'
Note: get_template_directory() points to the parent and get_stylesheet_directory() points to the child (or parent if there is no child)
- This reply was modified 3 years, 6 months ago by Storm Rockwell.
Forum: Developing with WordPress
In reply to: Search widget should not give result on Spaceif ( ! empty( trim( get_search_query() ) ) { // Show results } else { // Do whatever you want to do with empty searches }
Here you go (:
<?php /* Template Name: Some template name */ add_action( 'wp_head', function() { // put your JSON LD data here } ); include 'page.php';
Forum: Developing with WordPress
In reply to: Get full size img width/height from Post API queryWere you looking for something like this? Pushed the width and height to “mediaDetails”
add_action( 'rest_api_init', function () { if ( ! function_exists( 'use_block_editor_for_post_type' ) ) { require ABSPATH . 'wp-admin/includes/post.php'; } // Surface all Gutenberg blocks in the WordPress REST API $post_types = get_post_types_by_support( [ 'editor' ] ); foreach ( $post_types as $post_type ) { if ( use_block_editor_for_post_type( $post_type ) ) { register_rest_field( $post_type, 'blocks', [ 'get_callback' => function ( array $post ) { $blocks = parse_blocks( $post['content']['raw'] ); foreach ( $blocks as $key => $block ) { if ( $block['blockName'] === 'core/image' ) { $meta = wp_get_attachment_metadata( $block['attrs']['id'] ); $blocks[ $key ]['mediaDetails'] = array( 'width' => $meta['width'], 'height' => $meta['height'], ); } } return $blocks; }, ] ); } } } );
- This reply was modified 5 years, 6 months ago by Storm Rockwell.
Forum: Fixing WordPress
In reply to: Removing “Read More” and adjusting Excerpt LengthTo change the excerpt length add this to your child themes functions file and change the number 20 to the length you would like
function wp11539068_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'wp11539068_excerpt_length', 999 );
https://codex.www.ads-software.com/Plugin_API/Filter_Reference/excerpt_length
Forum: Fixing WordPress
In reply to: Removing “Read More” and adjusting Excerpt LengthTo truly remove the read more buttons add this to your child theme to overwrite the one in the main theme
real-estate-lite-child/sections/service.php
<?php $title = esc_html( get_theme_mod('service_title')); $subtitle = esc_html( get_theme_mod('service_sub_title')); $first = esc_html( get_theme_mod('first_service')); $second = esc_html( get_theme_mod('second_service')); $third = esc_html( get_theme_mod('third_service')); ?> <div class="section service grey"> <div class="grid"> <h2 class="section-title"> <?php echo esc_html( $title) ; ?></h2> <?php if(!empty($subtitle)) : ?> <h5 class="section-sub-title"> <?php echo esc_html( $subtitle) ; ?></h5> <?php endif; ?> <?php // The Query $args = array( 'post_type' => 'page', 'post__in' => array($first,$second,$third), 'orderby' => 'post__in', ); $feature = new WP_Query( $args ); // The Loop if ( $feature->have_posts() ) { while ( $feature->have_posts() ) { ?><div class="col-4-12"><?php $feature->the_post(); if ( has_post_thumbnail() ) { ?> <div class='post-thumb'> <a href="<?php the_permalink();?>" > <?php the_post_thumbnail('real_estate_lite_page_thumb'); ?> </a> </div> <?php } ?> <?php the_title('<h2 class="entry-title">', '</h2>'); ?> <?php the_excerpt(); ?> <?php echo "</div>"; } } else { ?> <p><?php echo esc_attr( 'Sorry, no posts matched your criteria.' ); ?></p> <?php } /* Restore original Post Data */ wp_reset_postdata(); ?> </div> </div>
An easier way but a bit less clean is to hide the links in the service section like so
.service .read_more { display: none; }
if('#keyword'=="")
should beif ( jQuery('#keyword').val() == "" )
A better solution would be:
function fetch() { var input = $.trim( jQuery('#keyword').val() ); if ( input.length > 0 ) { jQuery.ajax({ url: "mywebsite/wp-admin/admin-ajax.php", type : "POST", data: { action: 'data_fetch', keyword: input }, success: function(data) { jQuery('#datafetch').html( data ); } }); } }
Also if you prefer to use the
$
for jQuery you can wrap your code in a closure like this:( function( $ ) { // JS code } ( jQuery ) )
`
Forum: Fixing WordPress
In reply to: SubdomainsWhat is sounds like is you changed the domains nameservers. You would need to change the nameservers back to what they originally were. I’m not familiar with wix and if they have their own DNS you can use to setup the subdomains, you could do that too.
Forum: Developing with WordPress
In reply to: Template Tag for Media CategoriesBy default, the taxonomy “categories” isn’t tied to Media. If you are trying to check for a specific taxonomy you would use
is_tax()
From my experience normally plugins have checks to ensure issues like this don’t occur. If you feel it’s not needed that’s your call and totally fine. I just won’t be able to use this plugin for future projects.
This isn’t an issue with my host, this is an issue with migrating code bases.
If the table fails to exist there should be checks in place to prevent this issue.
Forum: Plugins
In reply to: [WP SmartCrop] Not correctly cropping all image sizesIt looks like it fixed itself over time. I even tried a different browser to ensure it wasn’t cache haha.
Do you have any javascript errors? Possibly you update jQuery in the front-end but not the back-end. I know slick requires jQuery 1.7+ and core uses 1.4 i believe
Forum: Reviews
In reply to: [WP SmartCrop] Not working in WP 5Currently facing the same issue