PhPCentre
Forum Replies Created
-
Forum: Hacks
In reply to: Create own custom menu itemThen use the add_menu_page() instead.
http://codex.wordpress.org/Function_Reference/add_menu_pageForum: Hacks
In reply to: Create own custom menu itemUse the add_theme_page() function
http://codex.wordpress.org/Function_Reference/add_theme_pageForum: Hacks
In reply to: query posts and exclude current postTry this:
'post__not_in' => array( get_the_ID() ),Forum: Hacks
In reply to: Passing an array from a loop in one partial to another partialLet’s see a screenshot of your design layout before and after moving the get_template_part(‘…’).
Forum: Hacks
In reply to: Passing an array from a loop in one partial to another partial@somedude77 I think the typo error @ronangelo pointed out might be the issue with your code. I did put up a sample plugin to try and replicate your issue with the codes above , but I did not find any. Also in my sample plugin, the result for the query is displayed via a shortcode, and I did insert the shortcode directly inside the index.php file.
However, inserting the shortcode before the loop in the index.php file, the global $index_of_ids is not available as the loop has not been executed yet, but using the shortcode after the loop in the index.php file, the global is available, I do not know whether this is the issue. Just double check and report your results.
Forum: Hacks
In reply to: Tell sidebar archive to use a different archive page for outputOk I get your point now, so I suggest use the template
date.phpto display archive for the monthly list to separate it from the archive page template used by the blog pages.Forum: Hacks
In reply to: Tell sidebar archive to use a different archive page for outputYou can exclude the featured post from the archive page using the meta value saved by the custom check-box field like this.
This approach is better as it will remove only the intended post instead of all post belonging to a particular category..Forum: Hacks
In reply to: Tell sidebar archive to use a different archive page for outputWhy don’t you exclude the category of your featured post form the archive list as suggested here:
https://wordpress.org/support/topic/remove-cetain-post-categories-from-blog-sidebar-archive-list
but this solution will exclude all post in that category not just the featured post.Considering your support threads here , here and here, This Amazon s3 and cloudfront plugin have got you covered,it will solve your issue.
Once installed, go to the plugin settings page, switch on the path option and you would notice an input field will immediately appear underneath, by default , the value would be something like this “wp-content/uploads” , now edit that input field and append your desired folder name like this ” bar/wp-content/uploads” and save your options.Then your url should come something like this.
http://s3‑us‑west‑1.amazonaws.com/bucket-name/bar/wp-content/uploads/photo.jpgHowever you can further extend your folder structure by enabling the year/month option. So your url could appear something like this
http://s3‑us‑west‑1.amazonaws.com/bucket-name/bar/wp-content/uploads/2015/03/photo.jpgUse this code, but first of all make sure you set path —( on ),
year/month — ( off ) in your plugin admin settings, then the code.// the priority for this filter must be less than 100. add_filter( 'wp_update_attachment_metadata','wp_update_attachment_metadata_2', 90, 2 ); function wp_update_attachment_metadata_2( $data, $post_id ) { $type = get_post_mime_type( $post_id ); $type = explode( '/', $type ); $ext = $type[ sizeof( $type ) - 1 ]; $folder = ''; $img_exts = array( 'jpg', 'jpeg', 'png', 'gif' ); if ( in_array( $ext, $img_exts ) ) { $folder = 'img'; } elseif ( $ext == 'pdf' ) { $folder = 'pdf'; } else { $folder = 'misc'; } if ( $folder ) { add_filter( 'as3cf_setting_object-prefix','dynamic_path_'.$folder, 10,1 ); } return $data; } function dynamic_path_img( $value ) { return 'img'; } function dynamic_path_pdf ( $value ) { return 'pdf'; } function dynamic_path_misc ( $value ) { return 'misc'; }And Of course you can adjust the folders on s3,for example, returning this string for image file ‘upload/img’ will store your images in folder ‘upload ‘under ‘img’ subfolder on s3.
Forum: Hacks
In reply to: Add New "Display Name As" Option – Combination of Username and First/Last Name@brayll the suggestion by @danielagw is by far the best solution I have found for users trying to achieve this hack, the only problem with his solution is that the filter
profile_updatewill update the display name in the db once for each new user the first time the profile page is updated, so the next time the user updates the first or last name, the profile page, the changes will not reflect on the display name. So here is a hack that should solve your problem.add_action( 'profile_update', 'my_profile_update', 10, 2 ); function my_profile_update( $user_id, $old_user_data ) { // Do something $user = get_user_by( 'id', $user_id ); $firstname = $user->first_name; $lastname = $user->last_name; $nickname = $user->nickname; if ( $firstname !== '' && $lastname !== '' && $nickname !=='' ) { remove_action( 'profile_update', 'my_profile_update', 10, 2 ); wp_update_user( array( 'ID' => $user_id, 'display_name' => $firstname.' "'.$nickname.'" '.$lastname ) ); } }So anytime a user updates the profile page,the changes are made immediately to the user display name. And Ofcourse you can customize the if statement however you want.
Forum: Hacks
In reply to: Adapting the 'Posts' menuUse the function
register_post_type()to register a custom post type for your Products menu.
http://codex.wordpress.org/Function_Reference/register_post_typeYes the error has something to do with the location of your bucket. You will get that error while trying to authenticate request to buckets located in Frankfurt region with AWS signature v2. The region will only accept signature v4.
I would like to know what version of the plugin are you using ?, cause this issue has already been fixed in newer versions of the plugin,please upgrade.
Obviously from the structure of your url, your settings option under domain should be “Bucket name in path” ,path–(off),month/year–(off) ,and if that is the case then the first ‘a’ in your url should be the region where the bucket is located, the second ‘a’ should be the bucket name and the last ‘a’ should be the filename. For example
http://s3‑us‑west‑1.amazonaws.com/bucket-name/photo.jpgAnyway for the function that returns the s3 URL,
check file:amazon-s3-clouldfront.php line:647 to know whether you can figure out the issue..Please can you give me the github link where the issue has been reported to confirm my doubts.