Adam Morgan
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Different Formatting Between Preview and Published VersionsHey @pouredandplated,
Do you have a screenshot of how the preview is looking at all or could you explain a little more about the differences?
Forum: Fixing WordPress
In reply to: Change ThemeHey @worldofyou,
If you actually install a new theme without activating it, you can go to appearance -> customise and preview how it would look.
If you’re happy with the preview you can “Save and Activate” the changes making it your active theme.
Whilst you shouldn’t have any issues, depending on the two themes, there may be differences in how they use current site data.
Hope this helps
Forum: Fixing WordPress
In reply to: How to change meta description for archive pages only?Hey both,
Whilst it’s certainly achievable to do it through your theme files, you may be better off looking at an SEO plugin such as:
https://en-gb.www.ads-software.com/plugins/autodescription/
https://en-gb.www.ads-software.com/plugins/wordpress-seo/This will make it easier and dynamic for you to use in the future.
If you’re keen to do it through your files, you’d probably need to look at your header.php or the area which your current meta description is defined. You’d potentially be able to achieve it via is_page or is_archive type conditionals.
All the best
Forum: Developing with WordPress
In reply to: Finding pages in the current siteHey @ncphpguy,
Just going off the WordPress documentation for get_pages() it specifies:
“NOTE: This function will currently not retrieve pages using the ‘meta_key’ and ‘meta_value’ parameters in the $args array as described below. Until this is fixed in the WordPress codebase, you may want to use get_posts() instead.” – https://codex.www.ads-software.com/Function_Reference/get_pages [Moderator note: the quoted note has since been removed from referenced page by bcworkz]
Try something like:
<?php $args = array( 'post_type' => 'page', 'meta_query' => array( array( 'key' => 'access_request_page', 'value' => ' ', 'compare' => '!=', //not equal to blank (change to requirements); ) ) ); $posts_array = get_posts( $args ); ?>
https://codex.www.ads-software.com/Template_Tags/get_posts
or potentially a WP_Query – https://codex.www.ads-software.com/Class_Reference/WP_Query
Hope this helps.
- This reply was modified 7 years, 9 months ago by Adam Morgan.
- This reply was modified 7 years, 9 months ago by bcworkz. Reason: quoted note will not be found in referenced page
Forum: Developing with WordPress
In reply to: Taxonomy list with commasHey CyberWoolf,
Try changing the
echo implode(" ", $out );
toecho implode(",", $out );
That should do the trick.
Hope this helps
Forum: Developing with WordPress
In reply to: Linking front-page.php to home.phpHey komiska,
Glad that you got it working.
Ye, it’s a little confusing. When you set a page to the “Posts Page” it no longer uses the page.php or custom template assigned.
It starts to use the home.php or index.php template hierarchy.
https://developer.www.ads-software.com/themes/basics/template-hierarchy/ covers this in a bit more detail and might help.
All the best
Forum: Developing with WordPress
In reply to: Linking front-page.php to home.phpHey komiska,
Have you set the posts page under Settings -> Reading?
If so you should be able to do something like:
<a href="<?php echo get_permalink( get_option( 'page_for_posts' ) ); ?>">Blog Page</a>
or from 4.5:
<?php $posts = get_post_type_archive_link( 'post' ); ?>
Hope this helps
Forum: Developing with WordPress
In reply to: Is it possible to WP Customizer?Hey @yeadh,
I Believe what you’re after is a “section”. Take a look over https://developer.www.ads-software.com/themes/customize-api/customizer-objects/ and it should guide you through it.
There’s a diagram at the top which shows the breakdown of each part.
All the best
- This reply was modified 7 years, 9 months ago by Adam Morgan.
Forum: Developing with WordPress
In reply to: Row loopHey theredeclipse,
So you’re trying to add a row div after every 4 loops?
The modulus operator should be able to handle this for you.
<?php $counter = 1; foreach($mypages as $page) { if($counter % 4 == 0) { echo '<div class="row">'; } the_content(); if($counter % 4 == 0) { echo '</div>'; } $counter++; }
This checks the counter value against a division of 4 and returns the remainder. If it’s 0 we add the markup.
You could always look at adding some media queries though and/or just display inline-block the div elements for a smoother layout.
Hope this helps
Adam
Forum: Fixing WordPress
In reply to: remove /blog from end of domain nameHey fondrick,
Do you have two parts to your website? Is WordPress just being used for your blog?
With WordPress being under /blog this would usually indicate that it has been installed in that folder rather than the root. This is typically used when you have an existing site and wish to bolt WordPress on for blogging etc.
Take a look over https://codex.www.ads-software.com/Integrating_WordPress_with_Your_Website and see if that mirrors what you’ve got.
If you don’t have anything in your root (no files etc) and wish to remove the blog you can either move the files to the root or continue using it under the blog folder but change a few things – https://codex.www.ads-software.com/Giving_WordPress_Its_Own_Directory
Hope this helps
Adam
Forum: Fixing WordPress
In reply to: Dashboard “Search Pages” only finds postsHey Kevindp,
It sounds like something is altering/interfering with your default search queries. This can sometimes be done accidentally through the pre_get_posts function when an is_admin check is left off.
Do you have a local or staging environment for your site? I would try switching the theme and disabling your plugins to see if you can debug where the issue is coming from.
As mentioned above, maybe take a look in your theme for any references to pre_get_posts to see if the queries are getting altered at some stage.
Hope this helps
Adam
Forum: Fixing WordPress
In reply to: What is the command for resizing images?Hey Virmodrosti,
You can use the https://developer.www.ads-software.com/reference/functions/add_image_size/ function to add new image sizes. These work just like the default ones (large, medium, thumbnail) etc.
add_action( 'after_setup_theme', 'wpdocs_theme_setup' ); function wpdocs_theme_setup() { add_image_size( 'crop-name-here', 240, 135 ); // 240 pixels wide by 135 pixels tall, soft proportional crop mode }
You can add the above to functions.php and any new images you upload afterwards which are bigger than that will also have a cropped version of that size created.
You can then use these in your theme through several functions. For example:
the_post_thumbnail( 'crop-name-here' );
For existing images, you will either need to use a regeneration plugin – https://en-gb.www.ads-software.com/plugins/search/regenerate+images/ or the WP CLI https://developer.www.ads-software.com/cli/commands/media/
Hope this helps
- This reply was modified 7 years, 9 months ago by Adam Morgan.
Forum: Fixing WordPress
In reply to: Sites Being Flagged As Containing MalwareHey 3001web,
Are you using the WP Spamshield plugin by any chance?
I searched a few of the strings above and they all seemed to lead to that.
The plugin seems to apply this on line 9192 of wp-spamshield.php
$js .= $ao_noop_open.'<script type=\'text/javascript\'>'.WPSS_EOL.'/* <![CDATA[ */'.WPSS_EOL.WPSS_REF2XJS.'=escape(document[\'referrer\']);'.WPSS_EOL.'hf4N=\''.$wpss_js_key.'\';'.WPSS_EOL.'hf4V=\''.$wpss_js_val.'\';'.WPSS_EOL.$cm_var.'jQuery(document).ready(function($){'.'var e="#commentform, .comment-respond form, .comment-form'.$cm_str.', #lostpasswordform, #registerform, #loginform, #login_form'.$tpr_str.', #wpss_contact_form'.$cf7_str.$gf_str.$bp_str;
I believe this helps prevent spam on the forms specified by querying the url or some other value.
Hope this helps.
Forum: Fixing WordPress
In reply to: meta_query compare NOT IN with an array of post metaHey metaphorcreations,
Hope you’re having a good weekend.
Is the value in the database a serialized array? If you want to use a single value to search a meta field which is a serialized array maybe trying giving the compare the LIKE and NOT LIKE parameter.
https://wordpress.stackexchange.com/questions/70864/meta-query-compare-operator-explanation gives a really good answer to what all the comparisons do.
https://wordpress.stackexchange.com/questions/55354/how-can-i-create-a-meta-query-with-an-array-as-meta-field – The first two answers here go over what you might be after. The second answer in particular is regarding user ID’s as well.
Hope this helps
Forum: Developing with WordPress
In reply to: kses_allowed_protocols FilterHey @vpjm30,
It looks like your issue is a bug which has been raised over at https://core.trac.www.ads-software.com/ticket/36033
There is a fix for this by the looks which is scheduled for a later version of WP – https://core.trac.www.ads-software.com/attachment/ticket/36033/36033.patch
You could apply that but it would mean altering core files. Depending on which version they implement it on you would maybe need to re-apply it.
Hope this helps